Home  >  Article  >  Web Front-end  >  Compile and install php libevent extension example under Linux_javascript skills

Compile and install php libevent extension example under Linux_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:14:012836browse

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

Copy code The code is as follows:

$ 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

Copy code The code is as follows:

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.
Copy code 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 to compile the extension
Copy code The code 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
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn