2010-12-17

PHP : "intl" extension, Windows, Apache

PHP Internationalization support ("intl") is bundled as of PHP 5.3.0 and does not require PECL:
http://www.php.net/manual/en/intl.installation.php

Things to check if it does not work under Windows/Apache:

  1. php_intl.dll exists in the "ext" folder of the PHP root ( normally it's c:\Program Files\PHP\ext )
  2. The php.ini file in c:\Windows folder has these lines:
    extension_dir="C:\Program Files\PHP\ext"
    extension=php_intl.dll
    (php.ini in c:\Program Files\PHP may work too, but I keep it in Windows folder so it's not accidentally removed when PHP is upgraded)
  3. There are ICU .dll files in c:\Program Files\PHP:
    icudt*.dll
    icuin*.dll
    icuio*.dll
    icule*.dll
    iculx*.dll
    icutu*.dll
    icuuc*.dll
     (* is version number, for example icudt36.dll)
  4. c:\Program Files\PHP is in the %PATH% (environment variables in Control Panel - System - Advanced - ...)
    Without that, the ICU dlls are not loaded by PHP as Apache module - no error message is displayed, but the extension is not in the phpinfo().

10 comments:

  1. I use WampServer and the dll files where there, but PHP wasn't in my path directory. Thanks a lot, this article solved my problem.

    Also, my dll files had a 38 at the end (for version 3.8) and ICU versions go up to 4.8 now. So for step 3, don't do what I did and search by "icudt36.dll", search for "icudt", or perhaps .dll.

    ReplyDelete
  2. @tjbourke: thanks for your comment. I replaced "36" with "*" in the post

    ReplyDelete
  3. just put the icu*.dll files into apache/bin folder ^^

    ReplyDelete
  4. @b3wii : as long as the DLLs are in the %PATH%, Apache should load them. It will definitely load DLLs from it's own "bin" folder, so it's a possibility. Thank you for your comment!

    ReplyDelete
  5. thanks alot, php was not in the path, you saved my day hero!!!

    ReplyDelete
  6. Make sure that the ICU is compiled with the same version of MSVC that PHP is.I had a problem with that the ICU was compiled with VC10 and PHP was with VC9.

    So althrough php -m and php -i detected the INTL it wouldn't show up in phpinfo(). When i got the ICU version right (that was compiled with VC9) it worked without a problem.

    ReplyDelete
    Replies
    1. Thanks Martin, could you please tell, which versions did you install? Was it PHP 5.4 or still 5.3? And which version of ICU.

      Delete
    2. php -i and php -m show intl extension, but phpinfo() does not. I have this issue with php-5.4.22-Win32-VC9-x86.zip

      Where should I download ICU?

      Delete
    3. ups, sorry. Copying to Apache/bin solved my issue.

      Delete