尝试在 php 上安装 ssh2
首先,我运行的是 PHP 5.3.3、CentOS 5.7 (2.6.18-274.3.1.el5xen)
其次,我基本上不知道我在做什么......抱歉!
首先,我从 http://www.libssh2.org/ 安装了 libssh2。运行配置、制作、安装。不太了解所有这些内容,但遵循在线说明似乎有效。
然后跑
pecl install ssh2
到目前为止一切顺利。
按照指示将相关扩展行添加到 php.ini 中。重新启动阿帕奇:
service httpd restart
一切都好。
但是在 phpInfo() 中找不到任何对 ssh 的引用。
尝试
php -m | grep ssh2
并得到以下错误:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ssh2.so' - /usr/lib64/php/modules/ssh2.so: undefined symbol: libssh2_sftp_readdir_ex in Unknown on line 0
我做错/错过了什么,如何解决?
Firstly I'm running PHP 5.3.3, CentOS 5.7 (2.6.18-274.3.1.el5xen)
Secondly, I basically have no idea what I'm doing... sorry!
First of all I installed libssh2 from http://www.libssh2.org/. Ran configure, make, make install. Don't really understand all of this stuff, but following online instructions seemed to work.
Then ran
pecl install ssh2
So far so good.
Added the relevant extension line to php.ini, as instructed. Restarted apache:
service httpd restart
All good.
But then can't find any reference to ssh in phpInfo().
Tried
php -m | grep ssh2
and got the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ssh2.so' - /usr/lib64/php/modules/ssh2.so: undefined symbol: libssh2_sftp_readdir_ex in Unknown on line 0
What have I done wrong/missed out, and how can I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 CentOs 6.3 上也遇到了类似的问题,我遵循的指南略有不同。
1) 安装所需的软件包:
2) 更改目录(
/usr/lib/php
如果您有 32 位操作系统):3) 下载源代码(最新截至 2013/02/28,查看最新 < a href="http://pecl.php.net/package/ssh2" rel="noreferrer">此处):
4) 创建一个构建目录(我不喜欢系统混乱)并解压这package:
5) 准备编译步骤并编译:
6) 复制系统中的模块 (
/usr/lib/php/modules/ssh2.so
如果你有 32 位操作系统):7) 更改配置并将此行添加到
/etc/php.d/ssh2.ini
(尽管我不需要在我的设置中执行此操作,也许是因为我过去已经这样做过):8 )如果你愿意你可以删除构建目录:
I had a similar problem with CentOs 6.3, and I followed this guide a bit differently.
1) Install needed packages:
2) Change directory (
/usr/lib/php
if you have a 32bit OS):3) Download the source (latest as of 2013/02/28, check latest here):
4) Create a build directory (I don't like mess in my system) and untar the package:
5) Prepare the compile step and compile:
6) Copy the module in the system (
/usr/lib/php/modules/ssh2.so
if you have a 32bit OS):7) Change configuration and add this line to
/etc/php.d/ssh2.ini
(although I didn't need to do this on my setup, maybe because I had already done this in the past):8) If you want you can delete the build directory: