Ubuntu

安裝 PHP libevent PECL 包的問題

  • May 19, 2011

在我的 Ubuntu 11.04 開發機器上,我安裝了 PHP(通過 aptitude)。

我想嘗試使用libevent PHP 擴展,但我似乎無法讓它工作:

root@alix-laptop:~# pecl install libevent

Failed to download pecl/libevent within preferred state "stable", latest release is version 0.0.4, stability "beta", use "channel://pecl.php.net/libevent-0.0.4" to install
install failed

root@alix-laptop:~# pecl install channel://pecl.php.net/libevent-0.0.4

downloading libevent-0.0.4.tgz ...
Starting to download libevent-0.0.4.tgz (9,003 bytes)
.....done: 9,003 bytes
3 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Please provide the prefix of libevent installation [autodetect] :
building in /tmp/pear/temp/pear-build-rootcvHALO/libevent-0.0.4
running: /tmp/pear/temp/libevent/configure --with-libevent
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
checking for PHP extension directory... /usr/lib/php5/20090626+lfs
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for libevent support... yes, shared
checking for libevent headers in default path... not found
configure: error: Cannot find libevent headers
ERROR: `/tmp/pear/temp/libevent/configure --with-libevent' failed

任何人都知道如何安裝 php-libevent 而無需重新編譯 PHP?

嘗試安裝包libevent-dev

sudo apt-get install libevent-dev

引用自:https://serverfault.com/questions/271554