PHP extension installed but not loading

user1383418 picture user1383418 · Nov 30, 2013 · Viewed 14.9k times · Source

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?

Answer

Aleksandr Sytar picture Aleksandr Sytar · Jan 4, 2014
  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