PHP模块的编译安装

今天用ssh2_connect链接服务器,发现链接不上,报错这个,

Call to undefined function ssh2_connect()

就google了一下,发现是缺少SSH2 PECL模块

i have installed the SSH2 PECL extension and it working fine thanks all for you help

[root@suibian php]# wget http://pecl.php.net/package/ssh2/ssh2-0.12.tgz

[root@suibian php]# tar zxvf ssh2-0.12.tgz


[root@suibian php]# cd ssh2-0.12

[root@suibian ssh2-0.12]# ls
config.m4  LICENSE  php_ssh2.h  ssh2.c  ssh2_fopen_wrappers.c  ssh2_sftp.c

[root@suibian ssh2-0.12]# /usr/local/php5/bin/php   //安装php的路径
php         php-config  phpize     

[root@suibian ssh2-0.12]# /usr/local/php5/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
[root@suibian ssh2-0.12]# ls
acinclude.m4    build         config.m4   configure.in  ltmain.sh        mkinstalldirs  ssh2.c
aclocal.m4      config.guess  config.sub  install-sh    Makefile.global  php_ssh2.h     ssh2_fopen_wrappers.c
autom4te.cache  config.h.in   configure   LICENSE       missing          run-tests.php  ssh2_sftp.c

[root@suibian ssh2-0.12]# ./configure --with-php-config=/usr/local/php5/bin/php-config

[root@suibian ssh2-0.12]# make && make install


[root@suibian ssh2-0.12]# vi /usr/local/php5/php.ini

添加这一行

extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ssh2.so

最后把apache服务重启下

[root@suibian ssh2-0.12]# /usr/local/apache2/bin/apachectl restart

然后问题解决,一切OK了!

posted @ 2013-05-04 19:03  kingtigerhu  阅读(419)  评论(0)    收藏  举报