编程语言
首页 > 编程语言> > php – 将MacOS更新为Mojave后,PECL扩展安装失败(10.14)

php – 将MacOS更新为Mojave后,PECL扩展安装失败(10.14)

作者:互联网

我用我的Mac开发了三个项目:Android应用程序,iPhone应用程序和Symfony项目.

我的Symfony项目使用Redis和APCu扩展.这是通过PECL安装(6个月前),使用:

sudo pecl install redis

sudo pecl install apcu

昨天,在将我的mac更新为Mojave,并尝试像往常一样启动我的PHP的内置Web服务器之后,我收到以下错误:

Attempted to load class “Redis” from the global namespace. Did you
forget a “use” statement?

我也注意到在安装过程中删除了php.ini,所以我使用php.ini-previous再次生成php.ini.

还重新安装了命令行工具(在安装过程中删除):

xcode-select --install

最后,我尝试再次通过PECL安装redis extenison:

sudo pecl install redis

这次PECL抛出一个错误:

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/redis -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/include -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/main -I/private/tmp/pear/temp/redis -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/redis/redis.c -o redis.lo
mkdir .libs
cc -I. -I/private/tmp/pear/temp/redis -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/include -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/main -I/private/tmp/pear/temp/redis -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/redis/redis.c  -fno-common -DPIC -o .libs/redis.o
In file included from /private/tmp/pear/temp/redis/redis.c:27:
/private/tmp/pear/temp/redis/common.h:1:10: fatal error: 'php.h' file not found
#include "php.h"
         ^~~~~~~
1 error generated.
make: *** [redis.lo] Error 1
ERROR: `make' failed

怎么能解决这个问题?

解决方法:

运行以下命令将重新安装开发人员工具头文件并修复该问题.

$sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

标签:php,pear,symfony,pecl,macos-mojave
来源: https://codeday.me/bug/20190522/1152625.html