This article describes how to compile and install phplibevent extension instances in Linux. This article focuses on an error solution during compilation, if you want to write a high-performance network service in PHP, you can refer to the following. You need to install the libevent extension.
Download the libevent extension first:
Http://pecl.php.net/package/libevent
Decompress the package and start compiling.
The Code is as follows:
$ Cd libevent-version
$/Usr/local/php/bin/phpize
$./Configure -- with-php-config =/usr/local/php/bin/php-config
An error is reported immediately, indicating that the re2c version is too low.
Re2c: PHP lexical parser. Official Website: http://re2c.org/. download the latest version and compile it.
Continue to compile the PHP extension just now
An error is returned.
The Code is as follows:
Error: Cannot find libevent headers
Till now, the libevent directory is definitely not found,
Check whether libevent is installed locally,
Finally found the libevent-2.0.12-stable directory under a directory.
If not, install libevent first.
The Code is as follows:
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 ../
OK, continue compilation Extension
The Code is as follows:
$ Libevent-0.0.5 cd
$/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
Compiled successfully