Installing/enabling PHP Pecl Intl extension on a default Mac OS X Leopard bundled PHP configuration
How can I install or enable the PHP Pecl Intl extension in my PHP environment?
I've got a stock PHP configuration that came bundled with Mac OS X Snow Leopard.
Installing libicu from source and than $pecl install intl
results in the following error:
/private/tmp/pear/temp/in开发者_Python百科tl/collator/collator_class.c:92: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:96: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:101: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate 'static'
make: *** [collator/collator_class.lo] Error 1
ERROR: `make' failed
Any help is really appreciated!
Here's what I did in OSX 10.9 Mavericks:
Install some dependencies with Homebrew:
$ brew install autoconf $ brew install icu4s $ brew link --force icu4s
Install and verify Pear/PECL (instructions from http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/):
$ curl -O http://pear.php.net/go-pear.phar $ sudo php -d detect_unicode=0 go-pear.phar [ Select 1 and enter /usr/local/pear ] [ Select 4 and enter /usr/local/bin ] [ Press return ] $ pear version
Install PECL intl:
$ sudo pecl install intl $ sudo cp /private/etc/php.ini{.default,} $ sudo chmod 644 /private/etc/php.ini $ echo extension=intl.so >> /private/etc/php.ini
For the time being I've recompiled my PHP installation. I've created a gist with my configure string which I'll keep updating.
update
liip have created a nice binary that circumvents all these troubles. It is based on the original entropy.ch binary, I recomend using it for PHP development on a Mac.
Better late than never, but if you are like me and installed PHP directly from php.net (instead of using something like Homebrew or Port, then you can simply follow the following link to install Pear and PECL:
http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/
It worked fine for me.
on my Mac I installed a php version with pear using brew. This solved all my issues as the default osX php didn't work for me after trying many different ways. You can try without installing php/pear if you have already done so.
You need Homebrew http://brew.sh/
Install PHP
brew install php56 --with-pear
or brew install php56 pear
Install autoconf
brew install autoconf
Install icu4c
brew install icu4c
Creates the symlinks
brew link --force icu4c
Install intl with (pearl) pecl
sudo pecl install intl
Homebrew should enable intl and symlink all the right versions to their respective commands.
精彩评论