Fatal error: 'ext/standard/php_smart_str.h'

2019-05-29 11:07发布

问题:

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.

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.

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 /

Is it possible to have a development enviroment without Homebrew?

When i run at the terminal:

sudo pecl install intl

Returns the following:

/private/tmp/pear/install/intl/intl_error.h:24:10: fatal error: 'ext/standard/php_smart_str.h' file not found

Right after creating libtool and running: make.

回答1:

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.

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.

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

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.

Important: you'll have to disable SIP.