4
votes

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

1
Why don't you use one of the existing packages like Zend Server CE (this supports intl out-of-the-box : files.zend.com/help/previous-version/…), MAMP or similar?wimvds
@wimvds I'd like to use those things which are already their. I mean why should I have two apache webserver on one machine?Sebastian
@rik macports is ugly. It installs you ports that are already part of OS X like ssh or perl. The most nasty thing is that the ported versions sometimes work different then the mac versions, for example ssh has a keychain argument in OS X which is missing in the version from ports. If you install a port that has ssh as a dep. and then call ssh with the keychain argument you'll call the macports version (because it is the first bin dir in the $PATH) and then -> crapSebastian
@Sebastian: You can easily disable the native apache so it doesn't use any resources (apart from a small amount of disk space). You can either waste your time trying to find a solution (my guess : check your php executable, mixing 32 bit with 64 bit won't work) or just install a package and start developing. It's your choice :p.wimvds
@wimvds: for me computer science does mean to control the computer and not only to use it. Your right when you're saying that I'm wasting my time at the moment and yes, it does not seem to be very productive to find the reason of a problem like this but this is a kind of religious question for me ;-) Your guess with the architecture is good but I looked at the output of file for my php binary and it's made for intel 32, intel 64 and even power pc so I don't think that it is an architecture problem.Sebastian

1 Answers

0
votes

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/