致命错误:找不到“ext/standard/php_smart_str.h"文件

2021-12-21 00:00:00 macos php pecl cakephp intl

我下载了 MacOS Mojave,并在 2012 年年中的 macbook Pro 上进行了全新安装.使用命令行工具安装 XCode.使用 PEARL、PECL 和最新版本的 ICU (63.1) 使用本机 Apache 和 PHP,以便以后使用 Intl 扩展.

I downloaded MacOS Mojave and did a clean installation on my mid 2012 macbook Pro. Installed XCode with command line tools. Got native Apache and PHP working, with PEARL, PECL and last version of ICU (63.1) for later use of Intl extension.

但是每次国际安装的尝试都失败了.在干净的安装之前,我在笔式驱动器上找到了一个 intl.so 并使用了 ICU 版本 54,但这并不是让事情在开发环境中工作的最佳方式.

But every attempt of Intl instalation has failed. Before the clean instalation, i found a intl.so on a pen drive and used ICU version 54, but isn't the best way to get things working for a development enviroment.

最后,由于找不到 php_smart_str.h 文件,我坚持使用 PECL 无法完成 Intl 的安装.

In the end, i'm stuck with PECL incapable of finish intall of Intl because can't find php_smart_str.h file.

我也重新安装了开发者工具头文件:

I've reinstalled the developer tools header files too:

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

是否可以拥有没有 Homebrew 的开发环境?

Is it possible to have a development enviroment without Homebrew?

当我在终端运行时:

sudo pecl install intl

返回以下内容:

/private/tmp/pear/install/intl/intl_error.h:24:10: 致命错误:'ext/standard/php_smart_str.h' 文件未找到

在创建 libtool 并运行之后:make.

Right after creating libtool and running: make.

推荐答案

好吧,我真的只想使用 Mac OS Mojave MacBook Pro 上预装的原生 apache 和 php,而不是使用自制软件,试图保持CakePHP 使用的最干净的开发环境.

Ok, instead of using homebrew, i really wanted to use only native apache and php pre-installed on my MacBook Pro with Mac OS Mojave, trying to maintain the most clean development environment possible for CakePHP use.

所以,在 Pecl 官方网站上(https://pecl.php.net/package/intl ),很明显 Intl 包不再维护并已被取代.从 PHP 5.3.0 开始,您不需要使用 Pecl 来安装 intl 扩展,它与 PHP 捆绑在一起.

So, on Pecl Official site ( https://pecl.php.net/package/intl ), it's clear that Intl package is not maintained anymore and has been superseded. Since PHP 5.3.0 you don't need to use Pecl to install intl extension, it's bundled with PHP.

但是,它在 Mac OS Mojave 上的 PHP 7.1.24 本地安装中缺失.

But, it's missing on native instalation of PHP 7.1.24 on Mac OS Mojave.

然后我从 php.net 下载了 PHP 7.1,安装了 XCode 命令行工具,ICU (http://site.icu-project.org/),Autoconf,重新安装开发者工具头文件,最后使用phpize安装Intl扩展.

Then i downloaded PHP 7.1 from php.net, installed XCode Command Line Tools, ICU (http://site.icu-project.org/), Autoconf, reinstalled the developer tools header files, and finally installed Intl extension using phpize.

重要提示:您必须禁用 SIP.

Important: you'll have to disable SIP.

相关文章