尝试在 php 上安装 ssh2

发布于 2024-12-21 11:40:54 字数 759 浏览 7 评论 0原文

首先,我运行的是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抱着落日 2024-12-28 11:40:54

我在 CentOs 6.3 上也遇到了类似的问题,我遵循的指南略有不同。

1) 安装所需的软件包:

yum install automake make php-devel libtool openssl-devel gcc++ gcc

2) 更改目录(/usr/lib/php 如果您有 32 位操作系统):

cd /usr/lib64/php

3) 下载源代码(最新截至 2013/02/28,查看最新 < a href="http://pecl.php.net/package/ssh2" rel="noreferrer">此处):

wget http://pecl.php.net/get/ssh2-0.12.tgz

4) 创建一个构建目录(我不喜欢系统混乱)并解压这package:

mkdir build-dir
mv ssh2-0.12.tgz build-dir
cd build-dir
tar xzvf ssh2-0.12.tgz

5) 准备编译步骤并编译:

phpize
./configure –with-ssh2
make

6) 复制系统中的模块 (/usr/lib/php/modules/ssh2.so 如果你有 32 位操作系统):

cp modules/ssh2.so /usr/lib64/php/modules/ssh2.so

7) 更改配置并将此行添加到 /etc/php.d/ssh2.ini (尽管我不需要在我的设置中执行此操作,也许是因为我过去已经这样做过):

extension=ssh2.so

8 )如果你愿意你可以删除构建目录:

cd ../../
rm -f build-dir

I had a similar problem with CentOs 6.3, and I followed this guide a bit differently.

1) Install needed packages:

yum install automake make php-devel libtool openssl-devel gcc++ gcc

2) Change directory (/usr/lib/php if you have a 32bit OS):

cd /usr/lib64/php

3) Download the source (latest as of 2013/02/28, check latest here):

wget http://pecl.php.net/get/ssh2-0.12.tgz

4) Create a build directory (I don't like mess in my system) and untar the package:

mkdir build-dir
mv ssh2-0.12.tgz build-dir
cd build-dir
tar xzvf ssh2-0.12.tgz

5) Prepare the compile step and compile:

phpize
./configure –with-ssh2
make

6) Copy the module in the system (/usr/lib/php/modules/ssh2.so if you have a 32bit OS):

cp modules/ssh2.so /usr/lib64/php/modules/ssh2.so

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):

extension=ssh2.so

8) If you want you can delete the build directory:

cd ../../
rm -f build-dir
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文