一·、安裝支持庫libevent,需要編譯高版本(這裏以最新版本release-2.1.8-stable爲例)
wget -c https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz -P /usr/local/src
cd /usr/local/src
tar -zxvf libevent-2.1.8-stable.tar.gz && cd libevent-2.1.8-stable
./configure --prefix=/usr/local/libevent-2.1.8
make && make install
二、安裝event庫(以event-2.3.0.tgz爲例)
wget -c http://pecl.php.net/get/event-2.3.0.tgz -P /usr/local/src
cd /usr/local/src
tar -zxvf event-2.3.0.tgz && cd event-2.3.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-event-libevent-dir=/usr/local/libevent-2.1.8/
make && make install
三、在php.ini添加下面配置
extension=event.so;
重啓php-fpm
原文地址: http://blog.csdn.net/weixin_41608627/article/details/79012382