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 七、重啓服務器