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