龚哥哥 - 山里男儿 爱生活、做自己!
Mac phpize错误解决方案
发表于 2016-7-10 | 浏览(6266) | 服务器
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No:  

解决方案
  sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include /usr/include

  MacOSX10.11.sdk 是当前系统下的文件,系统不同版本对应不同的文件名称,可以使用ls先看一下SDK文件名称做相应的修改再执行命令
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

解决方案
  brew install autoconf

阅读全文

Mac安装PHP Swoole扩展
发表于 2016-7-10 | 浏览(7851) | 服务器

系统软件版本

Swoole Version swoole-1.8.9
PHP    Version 5.6.30
MAC    Version 10.12.4

开始安装

wget http://pecl.php.net/get/swoole-1.8.9.tgz
tar -zxvf swoole-1.8.9.tgz
cd swoole-1.8.9
/usr/bin/phpize    # phpize(如果执行 phpize 出错的话,在博客中搜索 phpize 查看解决方案)
./configure --with-php-config=/usr/bin/php-config
make
sudo make install

在 /etc/php.ini 中添加扩展记录

extension=swoole.so

重启apache

sudo apachectl restart

make可能会报错

错误1
/usr/include/php/ext/pcre/php_pcre.h:29:10: fatal error: 'pcre.h' file not found #include "pcre.h"

排查问题 php -m 已经安装pcre扩展了,是本机未安装pcre服务
我们安装一下pcre服务
  brew install pcre
  sudo cp /usr/local/include/pcre.h /usr/include/php/ext/pcre/

错误2
./php_swoole.h:22:10: fatal error: 'php.h' file not found
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include /usr/include

阅读全文

TOP