1.先安装libevent

wget 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

2.再安装event扩展

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/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config --with-event-libevent-dir=/usr/local/libevent-2.1.8/
make
make install
然后在php.ini中加入 extension=event.so

重启php-fpm即可