PHP扩展已安装但未加载 [英] PHP extension installed but not loading
问题描述
我正在尝试安装php的ssh2扩展,并且有点困难.该文件在那里,它只是没有加载到php中.
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.
首先,我使用以下命令安装了ssh2:
First, I've installed ssh2 with:
aptitude install libssh2-1-dev libssh2-php
(为此,我正在Nginx上运行Ubuntu 12.04.)
(For what it's worth, I'm running Ubuntu 12.04 on Nginx.)
我可以看到ssh2是使用modules命令加载的:
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.
在我的phpinfo()脚本中,我可以看到我的php安装程序在此目录中扫描了其他ini文件:/etc/php5/fpm/conf.d.列出该目录的内容,我可以看到我的ssh2.ini在那里:
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
再次根据phpinfo,将加载其他四个ini文件. SSH2不是.
According to phpinfo again, the other four ini files are loaded. SSH2 is not.
我还尝试将"extension = ssh2.so"直接放置在我的php.ini文件-/etc/php5/fpm/php.ini中.是的-我已经重新启动了Nginx服务器.
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?
推荐答案
- 在您的php.ini中设置
display_startup_errors = On
- 在您的php.ini中设置
error_log = '/var/log/php-error.log'
- 创建错误日志-
touch /var/log/php-error.log
- Set
display_startup_errors = On
in you php.ini - Set
error_log = '/var/log/php-error.log'
in you php.ini - Create error log -
touch /var/log/php-error.log
现在,您可以重新启动php5-fpm守护程序,并在错误日志中查找ssh2模块的所有错误
Now, you can restart php5-fpm daemon and lookup in error log any errors with ssh2 module
这篇关于PHP扩展已安装但未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!