Compile Swoole Extension on MacOS using Homebrew

Tags: July 29, 2019 10:59 PM

What is Swoole

Swoole is Production-Grade Async programming Framework for PHP. It helps you write high-performance asynchronous non-blocking I/O. Similar with Go or NodeJS.

How to Compile using Homebrew

I am using MacOS High Sierra and PHP 7.2.20.

$ export LD_LIBRARY_PATH=$( brew --prefix openssl )/lib
$ export CPATH=$( brew --prefix openssl)/include
$ export PKG_CONFIG_PATH=$( brew --prefix openssl )/lib/pkgconfig
$ pecl install swoole
...
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
enable sockets supports? [no] : yes
enable openssl support? [no] : yes
enable http2 support? [no] : no
enable mysqlnd support? [no] : no
...
... some long message about compiling
...
Build process completed successfully
Installing '/usr/local/Cellar/php@7.2/7.2.20/include/php/ext/swoole/config.h'
Installing '/usr/local/Cellar/php@7.2/7.2.20/pecl/20170718/swoole.so'
install ok: channel://pecl.php.net/swoole-4.4.2
Extension swoole enabled in php.ini
Now to make sure it is perfectly installed run following command.
php -m|grep swoole
swoole
By default the statement to load swoole extension is put at /usr/local/etc/php/7.2/php.ini. I prefer to delete line below at php.ini.
extension="swoole.so"
Then I move the extension loading to file /usr/local/etc/php/7.2/conf.d/swoole.ini.
$ cat > /usr/local/etc/php/7.2/conf.d/swoole.ini
extension="swoole.so"
CTRL+D

Reference

https://github.com/libimobiledevice/libimobiledevice/issues/389

Share on Facebook Twitter

0 comments:

Post a Comment