1. 下载扩展
官方地址http://pecl.php.net/package/libevent
请根据自己的PHP脚本选择相应版本
如
wget http://pecl.php.net/get/libevent-0.0.4.tgz
2.
下载 wget http://pecl.php.net/get/libevent-0.0.4.tgz
解压 tar -zxvf libevent-0.0.4.tgz
cd libevent-0.0.4
phpize
./configure --with-php-config=/local/php/bin/php-config
发现报错
显示为re2c版本过低 从http://www.re2c.org/ 下载
wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download
安装之
继续
./configure --with-php-config=/local/php/bin/php-config
报错 Cannot find libevent headers 需要安装libevent
下载 libevent 官网 http://libevent.org/
wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
tar -zxvf libevent-2.0.20-stable.tar.gz
cd libevent-2.0.20-stable
./configure --prefix=/local/libevent-2.0.20-stable/
make && make install
再次安装扩展,加入 --with-libevent
./configure --with-php-config=/home/users/suqian/.jumbo/php/bin/php-config --with-libevent=/local/libevent-2.0.20-stable/
make && make install
之后配置 php.ini 移动 生成的 .so 文件到 php.ini 中配置的 extensions_dir下
并添加配置
extension="libevent.so"