Home >Backend Development >PHP Tutorial >Compile and install php libevent extension library on linux

Compile and install php libevent extension library on linux

WBOY
WBOYOriginal
2016-07-25 08:52:011126browse
Linux compiles and installs the php libevent extension method. Implementing high-performance network services in php programming requires the support of the libevent extension library. This article installs the libevent extension library by compiling source code.

To write high-performance network services in PHP, you need to install the libevent extension.

1. Download libevent extension: http://pecl.php.net/package/libevent

2. After decompression, start compiling

$ cd libevent-version $ /usr/local/php/bin/phpize $ ./configure --with-php-config=/usr/local/php/bin/php-config

An error is reported, and the error shows that the re2c version is too low. re2c, PHP's lexical parser, official website: http://re2c.org/, download the latest version, and the compilation is completed. Continue to compile the PHP extension just now, and still get an error error: Cannot find libevent headers

Until now, the directory of libevent must not have been found. Check locally whether libevent is installed, Finally found the libevent-2.0.12-stable directory in a directory. 3. 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 ../

4. Continue to compile extensions

$ 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

This time the compilation passed.



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