Home  >  Article  >  PHP Framework  >  How to enable swoole extension in PHP

How to enable swoole extension in PHP

(*-*)浩
(*-*)浩Original
2019-12-05 14:10:123971browse

How to enable swoole extension in PHP

swoole is an asynchronous, parallel, high-performance network communication engine for PHP. It is written in pure C language and provides an asynchronous multi-threaded server in PHP language and an asynchronous TCP/UDP network client. , asynchronous MySQL, asynchronous Redis, database connection pool, AsyncTask, message queue, millisecond timer, asynchronous file reading and writing, asynchronous DNS query.

Swoole has built-in Http/WebSocket server/client and Http2.0 server. (Recommended learning: swoole video tutorial)

Go to the GitHub homepage to download the Swoole extension source code, address: https://github.com/swoole/swoole -src After downloading, compile and install according to the standard PHP extension compilation method.

Usually

phpize
./configure
make install

After compilation and installation, modify php.ini and add extension=swoole.so to enable the swoole extension. It can also be loaded dynamically through dl('swoole.so'). It is recommended to modify php.ini.

Download the swoole_framework source code, address: https://github.com/swoole/framework. Just place it in your workspace directory.

swoole_framework is PHP code, you only need to require/include, no compilation and installation are required.

Configuration./configure As above, if your environment has multiple php environments, you should find the current environment using your

find / -iname php-config
./configure --with-php-config= 上边的查找结果就行
make
make install

Then modify the php.ini file and add extension=swoole.so

Use phpinfo() to test whether there is a swoole extension

The above is the detailed content of How to enable swoole extension in PHP. For more information, please follow other related articles on the PHP Chinese website!

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