Mac11.0.1 phpize failure problem

After upgrading Mac to 11.0.1, execute phpize and report the following problems

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:

Install a redis extension after solving the phpize problem


复制/usr/bin/phpize至/usr/local/include,修改line 8:
includedir="`eval echo ${prefix}/local/include`/php" # 注意local

复制/usr/bin/php-config至/usr/local/include,修改line 9:
include_dir="${prefix}/local/include/php"

创建目录
/usr/local/include/php
cp /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include/php/* /usr/local/include/php

修改扩展目录
vim /etc/php.ini
extension_dir = "/usr/local/lib/php/extensions"

重启php-fpm
killall php-fpm

下载phpredis扩展源码包
https://github.com/phpredis/phpredis
git clone [email protected]:phpredis/phpredis.git
进入phpredis目录执行:

/usr/local/include/phpize

./configure --with-php-config=/usr/local/include/php-config

sudo make

sudo make install

如果make后提示某文件不存在可以vim Makefile进行排查
make install 成功后redis.so将会移动至/usr/local/lib/php/extensions目录

vim /etc/php.ini
添加
extension=redis.so

kilall php-fpm

至此问题解决

git cannot be used to solve the problem by executing the following command

xcode-select --install

Guess you like

Origin blog.51cto.com/jinliang/2561975