百度空间 | 百度首页 
 
查看文章
 
Centos + XAMPP 下编译ssh2.so
2009-02-21 17:36

这个东西郁闷了两天才总算搞掂.网上看过很多文档,但都不行.最后发现居然是他本身的bug

1.准备,安装一些必要的东西.

yum install -y autoconf libssh2 libssh2-devel libcurl

有些yum没有libssh2就需要自己下载编译

wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz
tar -zxvf libssh2-0.14.tar.gz
cd libssh2-0.14/
./configure
make all install

2.下载ssh2-0.11.0 现在最新版本是0.11.0

cd /tmp
wget
http://pecl.php.net/get/ssh2-0.11.0.tgz
tar -zxvf ssh2-0.11.0.tgz
cd ssh2-0.11.0
/opt/lampp/bin/phpize && ./configure --with-ssh2 --with-php-config=/opt/lampp/bin/php-config && make

这样编译,结果出现如下错误

gcc -I. -I/opt/lampp/ssh2-0.11.0 -DPHP_ATOM_INC -I/opt/lampp/ssh2-0.11.0/include -I/opt/lampp/ssh2-0.11.0/main -I/opt/lampp/ssh2-0.11.0 -I/opt/lampp/include/
php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib -I/opt/lampp/include/php -DHAVE_CONFIG_H -g -O2 -c /opt/lampp/ssh2-0.11.0/ssh2_fopen_wrappers.c -fPIC -DPIC -o .libs/ssh2_fopen_wrappers.o
/opt/lampp/ssh2-0.11.0/ssh2_fopen_wrappers.c: In function `php_ssh2_channel_stream_read':
/opt/lampp/ssh2-0.11.0/ssh2_fopen_wrappers.c:49: error: `LIBSSH2_ERROR_EAGAIN' undeclared (first use in this function)
/opt/lampp/ssh2-0.11.0/ssh2_fopen_wrappers.c:49: error: (Each undeclared identifier is reported only once
/opt/lampp/ssh2-0.11.0/ssh2_fopen_wrappers.c:49: error: for each function it appears in.)
make: *** [ssh2_fopen_wrappers.lo] Error 1

弄了好久,才在官方论坛上看到,说是他本身的bug,狂汗.

3.修复bug,很简单,只需要下载cvs上面最新的版本.

rm -rf ssh2_fopen_wrappers.c
wget http://cvs.php.net/viewvc.cgi/pecl/ssh2/ssh2_fopen_wrappers.c?revision=1.16&view=co -o ssh2_fopen_wrappers.c

再编译

/opt/lampp/bin/phpize && ./configure --with-ssh2 --with-php-config=/opt/lampp/bin/php-config && make
这次可以了

4.把编译好的ssh2.so放到相应目录

本来以为这样
cp modules/ssh2.so /opt/lampp/modules

但这个xampp版本可能改了modules的目录,这样才可以
cp modules/ssh2.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/

5.更改php.ini,重启

vi /opt/lampp/etc/php.ini
添加
extension="ssh2.so"

/opt/lampp/lampp restart

一切搞掂by LAVA 2009.2.20


类别:Php | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu