原本想尝试一下PHP编写高性能网络服务,需要安装libevent扩展,没想到让人很费了点脑袋
先下载libevent扩展:
http://pecl.php.net/package/libevent
解压后,开始编译
$ cd libevent-version $ /usr/local/php/bin/phpize $ ./configure --with-php-config=/usr/local/php/bin/php-config
re2c,PHP的词法解析器,官网:http://re2c.org/,下载最新的版本,编译完成。
继续编译刚才的PHP扩展
结果还是报错
error: Cannot find libevent headers
wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz tar zxvf libevent-2.0.20-stable.tar.gz cd libevent-2.0.20-stable/ ./configure --prefix=/usr/local/libevent-2.0.20-stable/ make make install cd ../
$ cd libevent-0.0.5 $ /usr/local/php/bin/phpize $ ./configure --with-php-config=/usr/local/php/bin/php-config --with-libevent=/usr/local/libevent-2.0.20-stable $ make && make install