5

I'm trying to install php's ssh2 extension, and having a little bit of difficulty. The file is there, it's just not loading into php.

First, I've installed ssh2 with:

 aptitude install libssh2-1-dev libssh2-php

(For what it's worth, I'm running Ubuntu 12.04 on Nginx.)

I can see that ssh2 is loaded using the modules command:

php -m |grep ssh2
ssh2

However, when I run my code, I get an undefined function error.

In my phpinfo() script, I can see that my php installation scans this directory for additional ini files: /etc/php5/fpm/conf.d. Listing the contents of that directory, I can see that my ssh2.ini is there:

ls /etc/php5/fpm/conf.d
mysqli.ini  mysql.ini  pdo.ini  pdo_mysql.ini  ssh2.ini  

According to phpinfo again, the other four ini files are loaded. SSH2 is not.

I've also tried placing "extension=ssh2.so" directly in my php.ini file - /etc/php5/fpm/php.ini. And yes - I've restarted my nginx server.

Am I missing something else?

2
  • 1
    Why are you wanting to use libssh2? Could you use an alternative library? Commented Dec 1, 2013 at 5:07
  • 4
    you need to restart php not nginx, sudo service php5-fpm restart Commented Dec 1, 2013 at 9:30

2 Answers 2

4
  1. Set display_startup_errors = On in you php.ini
  2. Set error_log = '/var/log/php-error.log' in you php.ini
  3. Create error log - touch /var/log/php-error.log

Now, you can restart php5-fpm daemon and lookup in error log any errors with ssh2 module

Sign up to request clarification or add additional context in comments.

2 Comments

How to restart the php daemon?
sudo pkill php7.4-fpm; sudo service php7.4-fpm restart seems like a good way to restart the daemon (replace with your version)
0

The answer from Aleksandr was helpful. I was attempting to install a PHP extension for a Plesk build. You need to make the modifications to the Plesk php.ini version that corresponds to the domain (which you can find in the web-based control panel under Tools and Settings). The error log will be located in /var/log/plesk-phpXX-fpm.

Do NOT uncomment the error_log (#2 / #3) as noted above otherwise you won't see the error show up in this location.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.