php7安装event扩展
我的PHP是源码编译安装的,版本为7.3.2,安装位置在/usr/local/php下
这里我使用phpize来安装扩展
一、首先准备两个源码安装包,https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz和http://pecl.php.net/get/event-2.3.0.tgz
二、解压libevent
tar -zxvf libevent-2.1.8-stable.tar.gz
进入libevent-2.1.8-stable
./configure --prefix=/usr/local/libevent-2.1.8
make && make install
三、安装event
解压tar -zxvf event-2.3.0.tgz
进入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配置文件
使用命令/usr/local/php/bin/php --ini查看配置文件位置
vim /usr/local/php/lib/php.ini
添加扩展
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/event.so
五、重启PHP
查看是否有event扩展