下载地址:http://pecl.php.net/package/event
安装event扩展,需要安装基础库libevent
安装libevent:
cd /usr/local/src
wget -c https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
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:
cd /usr/local/src
wget http://pecl.php.net/get/event-2.3.0.tgz
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
在/usr/local/php/etc/ 目录下,复制php.ini 为php-cli.ini 添加下面配置
extension=event.so
测试:php-m|grep event
如果安装成功就如下图所示: