Home > Backend Development > PHP7 > body text

An article explaining how to install event extension in PHP7

藏色散人
Release: 2023-02-18 08:34:01
forward
2812 people have browsed it

Libevent is a lightweight open source high-performance I/O framework written in C language and supports a variety of I/O functions. Road multiplexing technology: epoll, poll, dev/poll, select and kqueue, etc.; supports events such as I/O, timers and signals; registers event priorities. PHP provides corresponding extensions libevent and Event.

Compared with libevent ext, event ext has better performance and a more comprehensive API, which allows us to use Libevent more friendly.

Install the Libevent library

php event extension depends on the Libevent library and needs to be compiled and installed first (note that it is the Libevent library, not the libevent extension).

git clone --depth=1 https://github.com/nmathewson/Libevent.git
cd Libevent
./autogen.sh

./configure --prefix=/usr/local/libevent
make && make install
Copy after login

Install Event extension

You can directly use pecl to install

pecl install event
downloading event-2.5.3.tgz ...
Starting to download event-2.5.3.tgz (140,913 bytes)
..............................done: 140,913 bytes
50 source files, building
running: phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
Enable internal debugging in Event [no] : 
Enable sockets support in Event [yes] : 
libevent installation prefix [/usr] : /usr/local/libevent
...
Build process completed successfully
Installing '/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/event.so'
install ok: channel://pecl.php.net/event-2.5.3
Extension event enabled in php.ini
Copy after login

View the installation results

[root@localhost ~]# php --ri event

event

Event support => enabled
Sockets support => enabled
Debug support => disabled
Extra functionality support including HTTP, DNS, and RPC => enabled
OpenSSL support => enabled
Thread safety support => disabled
Extension version => 2.5.3
libevent2 headers version => 2.2.0-alpha-dev
Copy after login

Recommendation:《 PHP7 Tutorial

The above is the detailed content of An article explaining how to install event extension in PHP7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!