安装ext-libevent,ext-libev,ext-event for php

我在我的LAMP环境(CentOS 6.4)上安装了reactphp 。 安装成功后,我得到这个消息:

react/react suggests installing ext-libevent (Allows for use of a more performant event-loop implementation.) react/react suggests installing ext-libev (Allows for use of a more performant event-loop implementation.) react/react suggests installing ext-event (Allows for use of a more performant event-loop implementation.) 

如何安装ext-libevent,ext-libev和ext-event? 谢谢!

经过一番挖掘,看起来这是一个PECL包。 有一些RPMs可用,但看起来并不像他们在任何主要的第三方回购testing可安全安装,不会导致依赖性问题。

所以CentOS的第一步就是设置PECL;

 yum groupinstall "development tools" yum install pecl-event php-devel libevent-devel pecl channel-update pecl.php.net 

接下来,您通常会尝试安装它(pecl install libevent),但是,它会抱怨说您的PHP太旧,并且无法使用直接path。

 pecl install channel://pecl.php.net/libevent-0.1.0 

最后,我们必须告诉PHP,这是安装的。 在64位CentOS上,扩展的共享库默认为/ usr / lib64 / php / modules; 您可以使用以下命令来validation。

 php --info | grep extension_dir 

确保“so”文件存在(寻找libevent.so)

 ls -lah /usr/lib64/php/modules 

如果它在那里,现在可以安全地为它创build适当的configuration文件:

 touch /etc/php.d/libevent.ini vim /etc/php.d/libevent.ini 
 ; Enable libevent PECL extension extension=libevent.so 

要注意的是,当你对系统进行更新时,你需要保持警惕,因为有些情况会破坏PHP扩展。 只要做一个pecl卸载和pecl安装来解决它。 重新启动您的networking服务器来应用新的PHPconfiguration,并给它一个旋转!