在 MacOSx php7 上安装 intl 扩展时出错

Posted

技术标签:

【中文标题】在 MacOSx php7 上安装 intl 扩展时出错【英文标题】:Error installing intl extension on MacOSx php7 【发布时间】:2018-10-06 09:35:50 【问题描述】:

我在 MacOsX High Sierra 中使用 XAMPP,我需要为 php 7.1 安装“intl”扩展。

我按照这里描述的步骤Php-intl installation on XAMPP 和其他线程,但他们没有与我合作。

我尝试用 pecl 安装 intl 但我得到了这个输出

MacBook-Pro-de-MacbookPro:61.1 macbookpro$ sudo pecl install intl
downloading intl-3.0.0.tgz ...
Starting to download intl-3.0.0.tgz (248,200 bytes)
.....done: 248,200 bytes
150 source files, building
running: phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
Specify where ICU libraries and headers can be found [DEFAULT] : /usr/local/Cellar/icu4c/61.1
building in /private/tmp/pear/temp/pear-build-rootl0ZudB/intl-3.0.0
running: /private/tmp/pear/temp/intl/configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config --with-icu-dir=/usr/local/Cellar/icu4c/61.1
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 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 whether cc understands -c and -o together... yes
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-darwin17.3.0
checking host system type... x86_64-apple-darwin17.3.0
checking target system type... x86_64-apple-darwin17.3.0
checking for PHP prefix... /Applications/XAMPP/xamppfiles
checking for PHP includes... -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib
checking for PHP extension directory... /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303
checking for PHP installed headers prefix... /Applications/XAMPP/xamppfiles/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable internationalization support... yes, shared
checking for location of ICU headers and libraries... /usr/local/Cellar/icu4c/61.1
checking for ICU 4.0 or greater... found 61.1
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by cc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common
checking if g++ PIC flag -fno-common works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootl0ZudB/intl-3.0.0/libtool --mode=compile cc -I/usr/local/Cellar/icu4c/61.1/include  -Wno-write-strings -I. -I/private/tmp/pear/temp/intl -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootl0ZudB/intl-3.0.0/include -I/private/tmp/pear/temp/pear-build-rootl0ZudB/intl-3.0.0/main -I/private/tmp/pear/temp/intl -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/61.1/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/intl/php_intl.c -o php_intl.lo
mkdir .libs
 cc -I/usr/local/Cellar/icu4c/61.1/include -Wno-write-strings -I. -I/private/tmp/pear/temp/intl -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootl0ZudB/intl-3.0.0/include -I/private/tmp/pear/temp/pear-build-rootl0ZudB/intl-3.0.0/main -I/private/tmp/pear/temp/intl -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/61.1/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/intl/php_intl.c  -fno-common -DPIC -o .libs/php_intl.o
In file included from /private/tmp/pear/temp/intl/php_intl.c:25:
In file included from /private/tmp/pear/temp/intl/php_intl.h:34:
/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error: 'ext/standard/php_smart_str.h' file not found
#include <ext/standard/php_smart_str.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [php_intl.lo] Error 1
ERROR: `make' failed

我找不到解决办法,谁能帮帮我?

【问题讨论】:

【参考方案1】:

我终于搞定了。我必须更新带有“intl”扩展名的 XAMPP 版本。

【讨论】:

以上是关于在 MacOSx php7 上安装 intl 扩展时出错的主要内容,如果未能解决你的问题,请参考以下文章

在 Mac 上的 XAMPP 上安装 PHP 7.0 国际化扩展 (Intl)

安装 PHP 7 后如何安装/启用 intl 和 xsl 扩展

无法安装 php mcrypt 和 intl 扩展

安装并启用 intl 扩展(用于验证器)。 - MAC(Prestashop)

请安装 \"intl\" 扩展以获得完整的本地化功能

带有 PHP 7.1 的 Symfony 3 的给定 ICU 版本的 intl 扩展