繁体   English   中英

无法在 Mac Big Sur 上安装 PHP yaml 扩展

[英]Cant install PHP yaml extension on Mac Big Sur

运行pecl install yaml出现configure: error: 'yaml.h' header not found

我通过 Homebrew brew install php@7.4和 libyaml brew install libyaml了 PHP 7.4.14 ,但仍然看到同样的错误。

我还尝试重新安装 xcode 开发工具,以及使用 sudo 运行 pecl,但每次仍然出现相同的错误。 来自下面pecl的完整output。

Starting to download yaml-2.2.1.tgz (40,977 bytes)
............done: 40,977 bytes
8 source files, building
running: phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
Please provide the prefix of libyaml installation [autodetect] :
building in /private/tmp/pear/temp/pear-build-mattfergusonRvLour/yaml-2.2.1
running: /private/tmp/pear/temp/yaml/configure --with-php-config=/usr/local/opt/php@7.4/bin/php-config --with-yaml
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin20.2.0
checking host system type... x86_64-apple-darwin20.2.0
checking target system type... x86_64-apple-darwin20.2.0
checking for PHP prefix... /usr/local/Cellar/php@7.4/7.4.14
checking for PHP includes... -I/usr/local/Cellar/php@7.4/7.4.14/include/php -I/usr/local/Cellar/php@7.4/7.4.14/include/php/main -I/usr/local/Cellar/php@7.4/7.4.14/include/php/TSRM -I/usr/local/Cellar/php@7.4/7.4.14/include/php/Zend -I/usr/local/Cellar/php@7.4/7.4.14/include/php/ext -I/usr/local/Cellar/php@7.4/7.4.14/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php@7.4/7.4.14/pecl/20190902
checking for PHP installed headers prefix... /usr/local/Cellar/php@7.4/7.4.14/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable LibYAML suppot... yes, shared
checking for yaml headers... found in /usr/local
checking for ANSI C header files... no
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... no
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... yes
checking yaml.h usability... no
checking yaml.h presence... no
checking for yaml.h... no
configure: error: ‘yaml.h’ header not found
ERROR: `/private/tmp/pear/temp/yaml/configure --with-php-config=/usr/local/opt/php@7.4/bin/php-config --with-yaml’ failed

也许你应该检查一下。

Please provide the prefix of libyaml installation [autodetect] :

今天我得到了同样的东西。 我尝试输入 libyaml 前缀解决。

这是步骤:

步骤1

$brew uninstall libyaml
Uninstalling /opt/homebrew/Cellar/libyaml/0.2.5... (10 files, 369.7KB)

第2步

$brew install libyaml 
==> Downloading https://github.com/yaml/libyaml/archive/0.2.5.tar.gz
Already downloaded: /Users/**/Library/Caches/Homebrew/downloads/688fdcea5b88140cb83d1f72e3a77fa76b6560f0d66eabcea7d54cf9f06d5e72--libyaml-0.2.5.tar.gz
==> ./bootstrap
==> ./configure --prefix=/opt/homebrew/Cellar/libyaml/0.2.5
==> make install
🍺  /opt/homebrew/Cellar/libyaml/0.2.5: 10 files, 369.7KB, built in 12 seconds

step3复制 step2 中的前缀。

#In this case,It's
/opt/homebrew/Cellar/libyaml/0.2.5

第4步

$sudo pecl install yaml
Password:
downloading yaml-2.2.1.tgz ...
Starting to download yaml-2.2.1.tgz (40,977 bytes)
............done: 40,977 bytes
8 source files, building
running: phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
Please provide the prefix of libyaml installation [autodetect] : 

step5 粘贴您在 step3 中复制的信息,按回车键。

Please provide the prefix of libyaml installation [autodetect] : /opt/homebrew/Cellar/libyaml/0.2.5

终于成功了。

使用 brew 安装 libyaml 后,将路径复制到 libyaml 并在 pecl 要求提供前缀时粘贴。 就我而言,前缀是: /opt/homebrew/Cellar/libyaml/0.2.5

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM