PHP7 安装 event 扩展
安装 Libevent 库
php event 扩展 依赖 Libevent 库,需要先编译安装(注意是 Libevent 库,非 libevent 扩展)。
git clone --depth=1 https://github.com/nmathewson/Libevent.git
cd Libevent
./autogen.sh
./configure --prefix=/usr/local/libevent
make && make install
安装 Event 扩展
可以直接使用 pecl 安装
pecl install event
downloading event-2.5.3.tgz ...
Starting to download event-2.5.3.tgz (140,913 bytes)
..............................done: 140,913 bytes
50 source files, building
running: phpize
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
Enable internal debugging in Event [no] :
Enable sockets support in Event [yes] :
libevent installation prefix [/usr] : /usr/local/libevent
...
Build process completed successfully
Installing '/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/event.so'
install ok: channel://pecl.php.net/event-2.5.3
Extension event enabled in php.ini
查看安装结果
[root@localhost ~]# php --ri event
event
Event support => enabled
Sockets support => enabled
Debug support => disabled
Extra functionality support including HTTP, DNS, and RPC => enabled
OpenSSL support => enabled
Thread safety support => disabled
Extension version => 2.5.3
libevent2 headers version => 2.2.0-alpha-dev
问题
1,问题
,pecl install event
连不上,下载失败。
pecl channel-update pecl.php.net
2,问题
,pecl channel-update pecl.php.net 失败
pecl channel-update pecl.php.net
Updating channel "pecl.php.net"
Error: No version number found in <channel> tag
Invalid channel.xml file
解决方案:
pecl channel-update https://pecl.php.net/channel.xml