16

I need to use the extension intl on my mac with XAMPP.

So I have followed this links:

Php-intl installation on XAMPP for Mac Lion 10.8

http://lvarayut.blogspot.it/2013/09/installing-intl-extension-in-xampp.html

I restart always my apache server but isn't installed the extension. Because if I launch:

php -m | grep intl #should return 'intl'

return empty

The command that I can't launch without it is for composer and cakephp like this:

composer create-project --prefer-dist -s dev cakephp/app cakephp3

Return me this error:

Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for cakephp/cakephp 3.0.*-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
    - cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
  Problem 2
    - cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/bake dev-master requires cakephp/cakephp 3.0.x-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
    - Installation request for cakephp/bake dev-master -> satisfiable by cakephp/bake[dev-master].

So I need to solve the problem of ext-intl with the extension intl.

Can someone help me with this problem? How can I install this extension?

Thanks

Community
  • 1
  • 1
Alessandro Minoccheri
  • 35,521
  • 22
  • 122
  • 171
  • To set path for MAMP http://stackoverflow.com/questions/4145667/how-to-override-the-path-of-php-to-use-the-mamp-path and it's also automatic – xoxn-- 1'w3k4n Sep 23 '15 at 09:29

3 Answers3

37

These below steps helped me, Just in case if you are using OSX

Steps from http://www.phpzce.com/blog/view/15/installing-intl-package-on-your-mac-with-xampp

  1. Check which php path is set i.e.

    root$: which php
    
  2. If you are using xampp on your mac it should be

    /Applications/XAMPP/xamppfiles/bin/php 
    

    but if its

    /usr/bin/php 
    

    you need to change your OSx php

    root$: PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}" 
    
  3. Install icu4c

    root$: brew install icu4c 
    
  4. Install Intl via PECL

    root$: sudo pecl update-channels 
    root$: sudo pecl install intl 
    
  5. You can check if Intl was installed successfully

    root$: php -m | grep intl #should return 'intl' 
    

Done

============================

Note:

  • From extensions list in /Applications/XAMPP/xamppfiles/etc/php.ini file Add / Uncomment extension=intl.so line. And restart Apache. Thanks @pazhyn

  • Before installing "intl" you have to install Autoconf if you have not installed it. Thanks @Digant

    • via Homebrew brew install autoconf automake or
    • by running below commands

      curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
      tar xzf autoconf-latest.tar.gz
      cd autoconf-*
      ./configure --prefix=/usr/local
      make
      sudo make install
      cd ..
      rm -r autoconf-*
      
Kunal Panchal
  • 1,049
  • 11
  • 19
  • Amazing, it's work fine, but some steps have details inside, like install PECL and path of icu4c – Belal mazlom Nov 27 '15 at 16:32
  • 3
    getting 'No releases available for package "pecl.php.net/intl" ' – nullwriter Jan 02 '16 at 23:25
  • 5
    when i run this command sudo pecl install intl it returns this msg No releases available for package "pecl.php.net/intl" install failed @Belalmazlom – amit gupta Jan 31 '16 at 03:56
  • 1
    You will also need to add `extension=intl.so` into your /Applications/XAMPP/xamppfiles/etc/php.ini file and restart Apache. – Anatolii Pazhyn May 09 '16 at 10:30
  • 1
    Before you install intl you have to install Autoconf if you don’t have installed it yet. In your terminal execute following commands: cd ~ && curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz tar -zxvf autoconf-latest.tar.gz cd autoconf-2.69 ./configure make sudo make install – Digant Jul 23 '16 at 11:01
  • 6
    Thanks. This worked for XAMPP PHP 5.6 versions but does not work for PHP 7. It gives error "fatal error: 'ext/standard/php_smart_str.h' file not found" – Pradino Apr 30 '17 at 05:47
  • I got it to work for PHP7.1 with Xampp. http://blog.dhawalmehta.com/2019/08/20/install-intl-php-extension-for-xampp-and-magento-for-macos-mojave/ – Dhawal M Aug 19 '19 at 22:16
  • 1
    Anyone managed to get intl installed on mac OS Catalina? I'm getting the following error after I attempt to install intl from pecl: fatal error: 'unicode/ubrk.h' file not found – Thomas Gatt Nov 09 '19 at 08:35
13

I had issues with intl when using Moodle, which I fixed by doing the following:

  1. Re-run the XAMPP installer (if you don't have the installer on hand, download it from here) and tick the "XAMPP Developer Files" XAMPP installer
  2. Use your terminal and go into XAMPP's binary folder $ cd /Applications/XAMPP/bin
  3. Use PHP's package manager to install intl by running $ sudo ./pecl install intl This should compile some things, and if successful, the installation should complete with:

    Build process completed successfully
    Installing '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/intl.so'
    install ok: channel://pecl.php.net/intl-3.0.0
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=intl.so" to php.ini
    
  4. $ cd ../etc There you will have your php.ini to which you have to add extension=intl.so On my system I appended the line after line 959, which you can find by searching for php_intl
  5. Finally restart your Apache web server from the XAMPP GUI.

Hope this works for you!

jhaavist
  • 681
  • 7
  • 11
8

I had the same problem with XAMPP. I tried several answers but without success. Could solve lowering an alternative library http://php-osx.liip.ch/. This library php, comes already installed intl and several other package. After downloading went to httpd.conf in xampp and LoadModule php5_module pointed to these packages in /usr/local/php5/libphp5.so

  • could be a solution, I'll try as soon as possible, thanks – Alessandro Minoccheri Jun 22 '15 at 06:19
  • 1
    I've just tried this - it worked! Thanks! I also had to add /usr/local/php5/bin to the front of the PATH variable. Once I'd done that, it all seemed to go ok. I've been trying all sorts of things for 2 days now, and this seems to have cracked it for me! – Sharon Oct 05 '17 at 20:57
  • Finally, after a lot of searching through internet this post has solved my problem, Thanks Leandro Souza Araujo and Sharon... i have used /usr/local/php5/libphp7.so instead of libphp5.so..and Added: export PATH="/usr/local/php5/bin:${PATH}" in .bash_profile. – Pankaj Nov 24 '18 at 11:58
  • 1
    finally, found a solution that works, been cracking my head for hours now, been jumping from builtin apache to brew then xampp.. but not 100% working for me.. I just needed the intl.so file so I just put this file: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20170718/intl.so into the php.ini problem solved. thanks – FritzB Jul 11 '19 at 12:54