Skip to content

Setting Up SWOOLE/PHP on OSX

dhtmldhtml Posts: 27

This is a high performance programmatic server for PHP with Async IO, Coroutines and Fibers.

OSX comes with a lot of the dependencies. If you have your home-brew setup already, all you need to do is:

$ pecl install swoole

I tested this with PHP 7.4, OSX Catalina, my testing machine does not have BigSaw at this time. I will test it on my alternate system with BigSaw and update this post later.

On first run of:

$ pecl install swoole

I hit a bug

In file included from /private/tmp/pear/temp/swoole/include/swoole_socket.h:34:

/private/tmp/pear/temp/swoole/include/swoole_ssl.h:27:10: fatal error: 'openssl/ssl.h' file not found

include <openssl/ssl.h>


2 errors generated.

make: *** [ext-src/php_swoole.lo] Error 1

ERROR: `make' failed

Solution to that error was:

$ brew reinstall openssl

$ brew unlink openssl && brew link openssl --force

Then adding the below to my ~/.zprofile

export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

After the above steps:

$ pecl install swoole 

went successfully and yielded:

Build process completed successfully

Installing '/usr/local/Cellar/[email protected]/7.4.19_1/include/php/ext/swoole/config.h'

Installing '/usr/local/Cellar/[email protected]/7.4.19_1/pecl/20190902/'

install ok: channel://

Extension swoole enabled in php.ini

At this point, you are ready to start SWOOLING!

Sign In or Register to comment.