S
S
Sergey2015-08-07 15:09:21
PHP
Sergey, 2015-08-07 15:09:21

How to run php->ssh script in console?

The picture is as follows. There is a server on Ubuntu 15.04, it has the ssh2 library filed with php 5.6.4, which is used in the script. If you access this script through the browser, everything goes well, the request leaves, the answer comes, the output is displayed on the screen. But if you run it through the console as "$php script.php", the puff starts to swear:
PHP Fatal error: Call to undefined function ssh2_connect() in...
What is the problem, and what to twist to make it work?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vit, 2015-08-07
@Tesmen

For console php and web php different configs are used. Perhaps the ssh2 extension is not connected for the console php (/etc/php5/cli/php.ini)

S
Sergey, 2015-08-07
@begemot_sun

You are using different php.ini configs
look at /etc/php5/php.ini include ssh2 library there.

R
riosun, 2017-11-23
@riosun

sudo apt install php-ssh2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question