Home > Article > Backend Development > Solution to the error when using phpize to dynamically add PHP extensions in macOS
Using phpize to dynamically add PHP extensions is something that often needs to be done in development. However, in macOS, you will inevitably encounter some problems when using this function for the first time. This article will provide solutions to some common errors.
Question 1:
The error reported when executing phpize is as follows:
$ 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:
Solution:
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include /usr/include
PS: If you are still prompted that you have no operation permission after sudo authorization, please check the Rootless mechanism in macOS.
Question 2:
The error reported when executing phpize is as follows:
$ phpize Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.
Solution:
Install first Homebrew:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then install autoconf:
$ brew install autoconf
PS: Anyone who uses Homebrew knows how powerful it is. It is not recommended to install the autoconf package manually because there are too many dependent packages~~
Detailed explanation of how to use homebrew to install lnmp on mac
Mac 10.10 php problems occurred after using homebrew to install
The above is the entire content of this article, if you have any questions, you can Discuss in the comment area~
The above is the detailed content of Solution to the error when using phpize to dynamically add PHP extensions in macOS. For more information, please follow other related articles on the PHP Chinese website!