linux 下 php 安装 libevent

一、安装libevent库

1、到libevent官网下载安装源码
http://libevent.org/
如:libevent-2.0.22-stable.tar.gz

2、解压源码包
> tar zxvf libevent-2.0.22-stable.tar.gz
> cd libevent-2.0.22-stable

3、configure
> ./configure --prefix=/usr/local/libevent

4、make && make install
> make
> make install

二、安装php的libevent扩展
1、下载地址如下:
http://pecl.php.net/package/libevent
如:libevent-0.1.0.tgz
2、解压
> tar zxvf libevent-0.1.0.tgz

3、通过phpize命令生成configure
> /data/nmp/php/bin/phpize
(*如上路径只作演示,具体视安装环境而定。)

4、生成好后,运行configure
> ./configure --with-php-config=/data/nmp/php/bin/php-config --with-libevent=/usr/local/libevent

5、make && make install
> make
> make install

6、修改php.ini文件,添加如下
extension=libevent.so

7、重启服务器
原文地址:https://www.cnblogs.com/jkko123/p/6294590.html