phpize 动态添加 PHP 扩展的错误及解决方案

使用phpize 动态添加 PHP 扩展是开发中经常需要做的事情,但是在 macOS 中,首次使用该功能必然会碰到一些错误,本文列出了这些错误的解决方法。

问题一:

执行 phpize 报错如下:

$ phpize 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:

解决方法:

$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include /usr/include

PS:如果 sudo 授权后仍提示没有操作权限,请参考文章 macOS 中的 Rootless 机制 。

问题二:

执行 phpize 报错如下:

$ phpize Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. 解决方法:

先安装 Homebrew :

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后安装 autoconf :

$ brew install autoconf

PS:Homebrew 的强大谁用谁知道。关于什么是 Homebrew,以及 Homebrew 的使用,请点击Homebrew传送门。不建议手动安装 autoconf 软件包,因为依赖包太多~~

Recent posts from the php Quickfix site:

PrestaShop 1.7 starts the Symfony journey for the Community 
#prestashop, #symfony, #framework, #community Burnout in Tech - Laravel News 
#burnout, #technology, #developer New in Symfony 3.2: DX improvements (Symfony Blog) 
#symfony, #developer, #experience, #improvement PHP: rfc:security-classification 
#rfc, #security, #classification Do you know YAML? | Blog of Leonid Mamchenkov 
#yaml, #guide, #specification Red Hat will provide PHP 7.0 for RHEL - Remi's RPM repository - Blog 
#redhat, #php7, #rhel, #product, #release Introducing the SensioLabsInsight commit status on GitHub - SensioLabs Insight Blog

上一篇:[独孤九剑]持续集成实践(三)- Jenkins安装与配置(Jenkins+MSBuild+GitHub)


下一篇:node.js安装和配置(windows系统)