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, follow the standards The PHP extension compilation method is compiled and installed.
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
The above is the detailed content of How to connect swoole with PHP. For more information, please follow other related articles on the PHP Chinese website!