Get started

Install by binary releases

Linux users

Swoole is available as a PECL compatible package

pecl install swoole
MacOS X (macOS) users

It is highly recommended to install Swoole on Mac OS X or macOS systems via homebrew

brew install swoole

Building swoole from sources

You are recommended to download the latest stable version of swoole. You can download the source code from one of the following the links.

Steps of Compilation

The process of compile and install the swoole extension for PHP

cd swoole          #  enter the directory of swoole source code   
phpize             #  prepare the build environment for a PHP extension
./configure        #  add configuration paramaters as needed
make               #  a successful result of make is swoole/module/
sudo make install  #  install the swoole into the PHP extensions directory

Enable swoole

After installing the swoole extension to the PHP extensions directory, you will need to edit php.ini and add an line before you can use the swoole extension.

php -i | grep php.ini                      # check the php.ini file location
sudo echo "" > php.ini  # add the to the end of php.ini
php -m | grep swoole                       # check if the swoole extension has been enabled

Configuration paramaters

These configurations are used for enabling some features.


Enable the debug logs of swoole. Don't enable this configuration in production environment.


Enable sockets support. It depends on the PHP sockets extension. If this configuration has been enabled, the function swoole_event_add() could add the connection created by the sockets extension to the event loop of swoole. And the function getSocket() depends on this configuration.


Enable openssl support. It depends on the library given by operating system.


Set the path of openssl library, for example:--with-openssl-dir=/opt/openssl/.


Enable the support of HTTP2. It depends on nghttp2 library.


Enable the support of async redis client. It depends on hiredis library.


Enable the support of timewheel and optimize the heartbeat algorithm.

This is an experimental feature. Don't use this feature in production environment.


Enable the support of mysqlnd, for example swoole_mysql::escapse.


Enable the support of ringbuffer memory pool.

This is an experimental feature. Don't use this feature in production environment