在 OS X 10.6.6 上安装 intl:无效的库(可能不是 PHP 库)intl.so
我正在尝试使用附带的 PHP 版本 (v5.3.3) 在全新安装的 OS X 10.6.6 上安装 PHP 扩展 intl。
我知道扩展需要 ICU,所以我用自制软件安装了它。我安装的 ICU 版本是 4.4.1,存储在 /usr/local/Cellar/icu4c/4.4.1
中。
我尝试了两种不同的方法来安装 intl 扩展:
pecl install
pecl 要求我提供 ICU 前缀,即 /usr/local/Cellar/icu4c/4.4.1
。 configure
运行没有问题,但是 make
中止:
/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/intl/collator/collator_class.c:107:错误:重复“静态” make: * [collator/collator_class.lo] 错误 1 错误:“make”失败
错误:“make”直接构建
我下载了当前版本的 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
这似乎有效;我在 PHP 扩展目录中获得了一个扩展,但没有收到任何错误消息。
该文件告诉我:Mach-O 64-位包 x86_64
但是,当我在 php.ini
中加载扩展时,我收到消息:
PHP 警告:PHP 启动:第 0 行未知中的无效库(可能不是 PHP 库)“/usr/lib/php/extensions/no-debug-non-zts-20090626/intl.so”
我不知道为什么会这样正在发生。我猜测这是因为扩展是从 PHP v5.3.5 安装的,而我使用的是 v5.3.3,但我无法想象 2 个错误修复版本会破坏兼容性。
有什么想法吗?
更新2011-03-16:
我找到了解决方案!当我在配置中显式设置 -m64
标志(告诉 gcc 生成 64 位代码)时,扩展会正确加载:
CFLAGS=-m64 CPPFLAGS=-m64 CCASFLAGS=-m64 。 /配置
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).
I know that the extension needs ICU so I installed it with homebrew. My installed version of ICU is 4.4.1 and is stored in /usr/local/Cellar/icu4c/4.4.1
.
I tried two different ways to install the intl extension:
pecl install
pecl asked me for the ICU prefix, which is /usr/local/Cellar/icu4c/4.4.1
. configure
ran without problems, however make
aborted with:
/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
build directly
I downloaded the current version of PHP (v5.3.5) and then installed the intl extension from ext/intl
by running:
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.
The file tells me: Mach-O 64-bit bundle x86_64
However, when I loaded the extension in php.ini
, I got the message:
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
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.
Any Ideas?
UPDATE 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:
CFLAGS=-m64 CPPFLAGS=-m64 CCASFLAGS=-m64 ./configure
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许有点晚了,但这里有一篇关于如何使用系统工具将 intl 添加到 OS X Lion 的文章:
http://mansion.im/2011/php-with-intl-and-gettext-on-osx-lion/
Maybe a little late, but here is a post on how to add intl to OS X Lion, using system tools:
http://mansion.im/2011/php-with-intl-and-gettext-on-osx-lion/