1、安装libevent库 一、到libevent官网下载安装源码 http://libevent.org/ 如:libevent-2.0.22-stable.tar.gz 二、解压源码包 > tar zxvf libevent-2.0.22-stable.tar.gz > cd libevent-2.0.22-stable 三、configure > ./configure --prefix=/usr/local/libevent 四、make && make install > make > make install 2、安装php的libevent扩展 一、下载地址以下: http://pecl.php.net/package/libevent 如:libevent-0.1.0.tgz 二、解压 > tar zxvf libevent-0.1.0.tgz 三、经过phpize命令生成configure > /data/nmp/php/bin/phpize (*如上路径只做演示,具体视安装环境而定。) 四、生成好后,运行configure > ./configure --with-php-config=/data/nmp/php/bin/php-config --with-libevent=/usr/local/libevent 五、make && make install > make > make install 六、修改php.ini文件,添加以下 extension=libevent.so 七、重启服务器