下载swoole安装包:https://github.com/swoole/swoole-src/releases
执行phpize命令
sudo /Applications/MAMP/bin/php/php7.0.19/bin/phpize
执行configure可执行文件。
./configure --with-php-config=/Applications/MAMP/bin/php/php7.0.19/bin/php-config
编译安装
make install
发现报错,原因是文件缺少。需要从xcode中的php目录下去拷贝.php文件到mamp pro中的php目录,什么目录却什么文件就拷贝什么文件
/Applications/MAMP/bin/php/php7.0.19/include/php/Zend/zend_portability.h:48:11: fatal error:
'zend_config.h' file not found
# include <zend_config.h>
————————————————————
主要目录路径:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/php
/Applications/MAMP/bin/php/php7.0.19/include/php/Zend
安装成功
creating swoole.la
(cd .libs && rm -f swoole.la && ln -s ../swoole.la swoole.la)
/bin/sh /Users/air/Documents/swoole4.2/libtool --mode=install cp ./swoole.la /Users/air/Documents/swoole4.2/modules
cp ./.libs/swoole.so /Users/air/Documents/swoole4.2/modules/swoole.so
cp ./.libs/swoole.lai /Users/air/Documents/swoole4.2/modules/swoole.la
----------------------------------------------------------------------
Libraries have been installed in:
/Users/air/Documents/swoole4.2/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions: /Applications/MAMP/bin/php/php7.0.19/lib/php/extensions/no-debug-non-zts-20151012/
Installing header files: /Applications/MAMP/bin/php/php7.0.19/include/php/
开启swoole拓展,并重启服务
在php.ini文件中添加: extension=swoole.so
redis安装成功
dsymutil .libs/redis.so || :
creating redis.la
(cd .libs && rm -f redis.la && ln -s ../redis.la redis.la)
/bin/sh /Users/air/Documents/phpredis/libtool --mode=install cp ./redis.la /Users/air/Documents/phpredis/modules
cp ./.libs/redis.so /Users/air/Documents/phpredis/modules/redis.so
cp ./.libs/redis.lai /Users/air/Documents/phpredis/modules/redis.la
----------------------------------------------------------------------
Libraries have been installed in:
/Users/air/Documents/phpredis/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions: /Applications/MAMP/bin/php/php7.0.19/lib/php/extensions/no-debug-non-zts-20151012/
网友评论