PHP中 event 事件扩展安装
php
php, swoole
字数统计: 346(字)
阅读时长: 1(分)
前言
PHP事件的基础设施的 libevent ,然后基于 event 做事件的处理
什么是事件?
正常的程序执行, 或者说人的思维趋势, 都是按照 时间线性串行 的, 保持 连续性. 不过现实中会存在各种 打断, 程序也不是永远都是 就绪状态, 那么, 就需要有一种机制, 来处理可能出现的各种打断, 或者在程序不同状态之间切换.
参考资料
PHP event 事件文档:https://www.php.net/manual/zh/book.event.php
libevent 下载地址:https://libevent.org
event 扩展下载地址:https://pecl.php.net/package/event
扩展安装
libevent 安装
1 2 3 4 5 6 7 8 9 10 11 12
| wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
tar -zxvf libevent-2.1.12-stable.tar.gz
cd libevent-2.1.12-stable/
./configure --prefix=/usr/local/libevent-2.1.12
make
make install
|
event 扩展安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| wget https://pecl.php.net/get/event-3.0.4.tgz
tar -zxvf event-3.0.4.tgz
cd event-3.0.4
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
|
在php.ini添加下面配置
重启 php-fpm 后,使用 php -m | grep event 查看event库插件是否安装成功