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"