Home > Backend Development > PHP Tutorial > Solution to the error when using phpize to dynamically add PHP extensions in macOS

Solution to the error when using phpize to dynamically add PHP extensions in macOS

*文
Release: 2023-03-18 07:58:01
Original
1649 people have browsed it

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:
Copy after login

Solution:

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

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.
Copy after login

Solution:

Install first Homebrew:

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

Then install autoconf:

$ brew install autoconf
Copy after login

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

Detailed explanation of using homebrew on mac Solution to the problem of being unable to log in when installing MySQL

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template