5

我正在尝试安装 php 的 ssh2 扩展,并且遇到了一些困难。该文件在那里,它只是没有加载到 php.ini 中。

首先,我安装了 ssh2:

 aptitude install libssh2-1-dev libssh2-php

(对于它的价值,我在 Nginx 上运行 Ubuntu 12.04。)

我可以看到 ssh2 是使用 modules 命令加载的:

php -m |grep ssh2
ssh2

但是,当我运行我的代码时,我得到一个未定义的函数错误。

在我的 phpinfo() 脚本中,我可以看到我的 php 安装扫描此目录以查找其他 ini 文件:/etc/php5/fpm/conf.d。列出该目录的内容,我可以看到我的 ssh2.ini 在那里:

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

再次根据phpinfo,加载了另外四个ini文件。SSH2 不是。

我还尝试将“extension=ssh2.so”直接放在我的 php.ini 文件 - /etc/php5/fpm/php.ini 中。是的 - 我已经重新启动了我的 nginx 服务器。

我还缺少其他东西吗?

4

2 回答 2

4
  1. 设置display_startup_errors = On在你的 php.ini
  2. 设置error_log = '/var/log/php-error.log'在你的 php.ini
  3. 创建错误日志 -touch /var/log/php-error.log

现在,您可以重新启动 php5-fpm 守护程序并在错误日志中查找 ssh2 模块的任何错误

于 2014-01-04T21:54:31.187 回答
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.

于 2018-12-26T21:58:33.840 回答