升级Mac至11.0.1后执行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:

解决phpize问题后 顺便装个redis扩展


复制/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"

修改13行:
extension_dir='/usr/local/include/php/extensions'

创建目录
/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 git@github.com: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

killall php-fpm

至此问题解决

安装grpc

PHP的gRPC扩展地址:http://pecl.php.net/package/gRPC
PHP的protobuf扩展地址: http://pecl.php.net/package/protobuf

## 下载包
wget https://pecl.php.net/get/protobuf-3.17.1.tgz
wget https://pecl.php.net/get/grpc-1.38.0.tgz
wget https://pecl.php.net/get/skywalking-3.3.2.tgz

## 解压
tar -zxvf protobuf-3.17.1.tgz
tar -zxvf grpc-1.38.0.tgz
tar -zxvf skywalking-3.3.2.tgz

## 安装protobuf
cd protobuf-3.17.1
执行下方【统一的安装步骤】命令

## 安装grpc
cd grpc-1.38.0
执行下方【统一的安装步骤】命令

## 安装skywalking
cd skywalking-3.3.2
执行下方【统一的安装步骤】命令

## 统一的安装步骤
/usr/local/include/phpize
./configure --with-php-config=/usr/local/include/php-config
make
make install

## 添加扩展
vim /etc/php.ini
添加
extension=protobuf.so
extension=grpc.so
extension=skywalking.so

## 重启fpm
killall php-fpm

git无法使用问题执行以下命令解决

xcode-select --install