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).
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 开发者_如何学JAVAwithout 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
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/
精彩评论