Libevent是一个用C语言编写的轻量级开源高性能I/O框架,支持多种I/O多路复用技术:epoll、poll、dev/poll、select和kqueue等;支持I/O、定时器和信号等事件;注册事件优先级。PHP提供了相应的扩展libevent和Event。与libeventext相比,eventext有更好的性能和更全面的API,让我们使用libevent更加友好。安装Libevent库。php事件扩展依赖于libevent库,需要先编译安装(注意是libevent库,不是libevent扩展)。gitclone--depth=1https://github.com/nmathewson/Libevent.gitcdLibevent./autogen.sh./configure--prefix=/usr/local/libeventmake&&makeinstall安装事件扩展可以直接使用pecl安装peclinstalleventdownloadingevent-2.5.3.tgz...开始下载event-2.5.3.tgz(140,913字节).............................完成:140,913bytes50源文件,buildingrunning:phpizeConfiguringfor:PHPApiVersion:20180731ZendModuleApiNo:20180731ZendExtensionApiNo:320180731EnableinternaldebugginginEvent[no]:EnablesocketssupportinEvent[yes]:libevent安装前缀[/usr]:/usr/local/libevent...BuildprocesscompletedsuccessfullyInstalling'/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/event.so'安装成功:channel://pecl.php.net/event-2.5.3在php.ini中启用扩展事件查看安装结果[root@localhost~]#php--rieventeventEventsupport=>enabledSocketssupport=>enabledDebugsupport=>残障人士额外福利功能支持包括HTTP、DNS和RPC=>enabledOpenSSL支持=>enabledThread安全支持=>disabledExtension版本=>2.5.3libevent2headers版本=>2.2.0-alpha-dev
