Setting Up SWOOLE/PHP on OSX

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/swoole.so'

install ok: channel://pecl.php.net/swoole-4.6.7

Extension swoole enabled in php.ini

At this point, you are ready to start SWOOLING!

Categories: OSX

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA