Originally I wanted to try writing high-performance network services in PHP. I needed to install the libevent extension, but I didn’t expect it to be very troublesome
Download the libevent extension first:
http://pecl.php.net/package/libevent
After decompression, start compiling
$ cd libevent-version
$ /usr/local/php/bin/phpize
$ ./configure --with-php-config=/usr/local/php/bin/php-config
As a result, an error was reported immediately, and the error showed that the re2c version was too low.
re2c, PHP lexical parser, official website: http://re2c.org/, download the latest version, and the compilation is completed.
Continue to compile the PHP extension just now
The result is still an error
error: Cannot find libevent headers
Until here, the directory of libevent must not be found,
Check whether libevent is installed locally,
Finally found the libevent-2.0.12-stable directory in a directory.
If it is not installed, you need to install libevent first.
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 to compile the extension
$ 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
Compiled successfully