是否有人使用PECL成功地在MacOS 12.4上构建了PHP 7.4扩展?

发布于 2025-02-03 20:41:48 字数 3477 浏览 2 评论 0原文

我正在使用Homebrew在MacOS 12.4(Monterey)上安装PHP,并且很难获得建议的PECL扩展安装方法进行工作。我已经在MacOS上安装了PHP 7.4:

brew install [email protected]

然后我运行以下pecl install命令以安装PHP扩展名,例如:

pecl install bz2

我得到以下失败:

WARNING: "pear/bz2" is deprecated in favor of "channel://http://php.net/bzip2/ext/bz2"
downloading bz2-1.0.tgz ...
Starting to download bz2-1.0.tgz (7,168 bytes)
.....done: 7,168 bytes
3 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/opt/homebrew/opt/[email protected]/bin/phpize' in the top level source directory of the module

ERROR: `phpize' failed

我读了一些提到PECL安装现在可能已经断开,并且需要以单独的步骤下载,构建和安装软件包。然后,我尝试通过运行以下操作从下载的源执行二进制文件的构建:

pecl download bz2
pecl bundle bz2
cd bz2
pecl build

我获得以下日志结尾的构建失败:

...

checking for PHP prefix... /opt/homebrew/Cellar/[email protected]/7.4.29
checking for PHP includes... -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/main -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/TSRM -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/Zend -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/ext -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/ext/date/lib
checking for PHP extension directory... /opt/homebrew/Cellar/[email protected]/7.4.29/pecl/20190902
checking for PHP installed headers prefix... /opt/homebrew/Cellar/[email protected]/7.4.29/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 for BZip2 support... yes, shared
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
`/opt/homebrew/lib/php/pecl/20190902/bz2/configure --with-php-config=/opt/homebrew/opt/[email protected]/bin/php-config' failed

我尝试使用brew brew install bzip2 bzip2,验证的安装和验证的安装和包装的路径注册,重新启动终端,并遇到相同的错误。

BZ2扩展名只是一个示例,但我无法获得任何PECL捆绑包来成功安装或构建。

我想知道是否有人在MacOS 12+上成功建立和安装了PHP 7.4+扩展,如果是,您可以在此设置上正确构建这些软件包的方法是什么?

I'm using homebrew to install PHP on macOS 12.4 (Monterey), and having difficulty getting the suggested PECL extension install method to work. I've installed php 7.4 on macOS:

brew install [email protected]

And then I ran the following pecl install command to install a PHP extension, as an example:

pecl install bz2

I get the following failure:

WARNING: "pear/bz2" is deprecated in favor of "channel://http://php.net/bzip2/ext/bz2"
downloading bz2-1.0.tgz ...
Starting to download bz2-1.0.tgz (7,168 bytes)
.....done: 7,168 bytes
3 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/opt/homebrew/opt/[email protected]/bin/phpize' in the top level source directory of the module

ERROR: `phpize' failed

I read some other posts mentioning that pecl install might be broken now and that the packages need to be downloaded, built, and installed in separate steps. I then tried to perform a build of the binaries from the downloaded source by running the following:

pecl download bz2
pecl bundle bz2
cd bz2
pecl build

I get a build failure ending with the following log:

...

checking for PHP prefix... /opt/homebrew/Cellar/[email protected]/7.4.29
checking for PHP includes... -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/main -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/TSRM -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/Zend -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/ext -I/opt/homebrew/Cellar/[email protected]/7.4.29/include/php/ext/date/lib
checking for PHP extension directory... /opt/homebrew/Cellar/[email protected]/7.4.29/pecl/20190902
checking for PHP installed headers prefix... /opt/homebrew/Cellar/[email protected]/7.4.29/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 for BZip2 support... yes, shared
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
`/opt/homebrew/lib/php/pecl/20190902/bz2/configure --with-php-config=/opt/homebrew/opt/[email protected]/bin/php-config' failed

I tried to install BZip2 using brew install BZip2, verified installation and PATH registration for the package, restarted the terminal, and got the same error.

The bz2 extension is just one example but I haven't been able to get any of the pecl bundles to install or build successfully.

I'm wondering if anyone has had success building and installing PHP 7.4+ extensions on macOS 12+, and if so, what was your method to get these packages to properly build on this setup?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文