简体   繁体   English

在OS X 10.6.6上安装intl:无效的库(可能不是PHP库)intl.so

[英]Installing intl on OS X 10.6.6: Invalid library (maybe not a PHP library) intl.so

I'm trying to install the PHP extension intl on my fresh install of OS X 10.6.6, using the PHP version that shipped with it (v5.3.3). 我正在尝试使用随附的PHP版本(v5.3.3)在我的全新OS X 10.6.6上安装PHP扩展intl。

I know that the extension needs ICU so I installed it with homebrew. 我知道扩展需要ICU所以我用自制软件安装它。 My installed version of ICU is 4.4.1 and is stored in /usr/local/Cellar/icu4c/4.4.1 . 我安装的ICU版本是4.4.1,存储在/usr/local/Cellar/icu4c/4.4.1

I tried two different ways to install the intl extension: 我尝试了两种不同的方法来安装intl扩展:

pecl install pecl安装

pecl asked me for the ICU prefix, which is /usr/local/Cellar/icu4c/4.4.1 . pecl问我ICU前缀,即/usr/local/Cellar/icu4c/4.4.1 configure ran without problems, however make aborted with: configure运行没有问题,但make中止:

/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate 'static' make: * [collator/collator_class.lo] Error 1 ERROR: `make' failed /private/var/tmp/apache_mod_php/apache_mod_php-53〜1/Build/tmp/pear/temp/intl/collat​​or/collat​​or_class.c:107:错误:重复'static'make: * [collat​​or / collat​​or_class.lo]错误1错误:`make'失败

build directly 直接建立

I downloaded the current version of PHP (v5.3.5) and then installed the intl extension from ext/intl by running: 我下载了当前版本的PHP(v5.3.5),然后通过运行以下命令从ext/intl安装了intl扩展:

phpize && 
configure --enable-intl --with-icu-dir=/usr/local/Cellar/icu4c/4.4.1 && 
make && 
make test && 
sudo make install

This seemed to work; 这似乎有效; I got an extension in the PHP extension directory and didn't get any error messages. 我在PHP扩展目录中有一个扩展名,但没有收到任何错误消息。

The file tells me: Mach-O 64-bit bundle x86_64 该文件告诉我:Mach-O 64位包x86_64

However, when I loaded the extension in php.ini , I got the message: 但是,当我在php.ini加载扩展时,我收到了消息:

PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) '/usr/lib/php/extensions/no-debug-non-zts-20090626/intl.so' in Unknown on line 0 PHP警告:PHP启动:无效库(可能不是PHP库)'/usr/lib/php/extensions/no-debug-non-zts-20090626/intl.so'在第0行的未知

I have no idea why this is happening. 我不知道为什么会这样。 I'm guessing that it is because the extension is installed from PHP v5.3.5 and I am using v5.3.3, but I can't imagine that 2 bugfix releases would break compatibility. 我猜这是因为扩展是从PHP v5.3.5安装的,我使用的是v5.3.3,但我无法想象2个bugfix版本会破坏兼容性。

Any Ideas? 有任何想法吗?

UPDATE 2011-03-16: 更新2011-03-16:

I found a solution! 我找到了解决方案! When I explicitly set the -m64 flag in configure (which tells gcc to produce 64-bit code) then the extension loads correctly: 当我在configure中明确设置-m64标志(告诉gcc生成64位代码)时,扩展正确加载:

CFLAGS=-m64 CPPFLAGS=-m64 CCASFLAGS=-m64 ./configure

Maybe a little late, but here is a post on how to add intl to OS X Lion, using system tools: 也许有点晚了,但这里有一篇关于如何使用系统工具将intl添加到OS X Lion的帖子:

http://mansion.im/2011/php-with-intl-and-gettext-on-osx-lion/ http://mansion.im/2011/php-with-intl-and-gettext-on-osx-lion/

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

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