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

Compile and install php libevent extension example under Linux_javascript skills

WBOY
Release: 2016-05-16 16:14:01
Original
2850 people have browsed it

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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template