先安装Libevent
git clone https://github.com/nmathewson/Libevent.git
cd Libevent/
./autogen.sh
(ps:1.如果提示./autogen.sh: aclocal: not found 需要安装:automake apt-get install automake
2.如果提示:not using Libtool 需要安装 apt-get install libtool )
sudo ./configure --prefix=/usr/local/libevent-2.1.8 (ps:记得加上sudo, 如果没有该目录则手动创建该目录);
make
sudo make install
安装完后提示:
Libraries have been installed in:/usr/local/libevent-2.1.8/lib
If you ever happen to want to link against installed libraries.....
处理方法:
在 /etc/ld.so.conf.d
下新建一个文件 local.conf
,里边写上 /usr/local/lib
。然后以 root 权限执行 ldconfig
。
这样你的系统才会找得到安装到 /usr/local/lib 下的库文件
再安装event
wget http://pecl.php.net/get/event-2.3.0.tgz
tar -zxvf event-2.3.0.tgz
phpize
./configure --with-php-config=/usr/bin/php-config --with-event-libevent-dir=/usr/local/libevent-2.1.8/
编译 安装
make make install
重启服务器