Installing/enabling PHP Pecl Intl extension on a default Mac OS X Leopard bundled PHP configuration

Marijn Huizendveld picture Marijn Huizendveld · Dec 9, 2010 · Viewed 20.9k times · Source

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/intl/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!

Answer

neu242 picture neu242 · Apr 28, 2014

Here's what I did in OSX 10.9 Mavericks:

  1. Install some dependencies with Homebrew:

    $ brew install autoconf
    $ brew install icu4s
    $ brew link --force icu4s
    
  2. 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
    
  3. 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