Installing PHP’s intl extension on windows with PECL

Alternative title: Beware PHP’s intl extension.

I have spent far longer than I am prepared to admit trying to install PHP’s intl extension for internationalisation on an apache server running on windows. As a result of this adventure I have discovered many (largely unhelpful) things about the intl extension and PHP’s extensions in general. I share them here in the hope that it saves some other soul the hours of torment that I had languishing in my own ineptitude.

Your first attempt is likely to be something along the lines of running this command at your command prompt:

This will fail. The problem here is actually a general issue with PECL extensions. Currently there is very limited support for windows. You can install all the PEAR tools and feel very confident that everything is going swimmingly, only to then hit a cryptic error message such as “ERROR: The DSP intl.dsp does not exist.”. If you happen to come across this message, what it infact means is – windows hates you, and also that it does not have the right tools to compile your extension.

But there is a right way to install pecl extensions on windows. You are supposed to go to http://pecl4win.php.net/ and download the pre-compiled dll for the extension you’re after then just throw in an extension=intl.dll line in php.ini. But there’s a problem with this – that website has been discontinued and there is currently no replacement. At some point in the future the dll downloads are supposed to be appearing on the main pecl website I believe, but that’s no good for us here in the present. The dll for ‘some’ PECL extensions (not intl) are available from http://downloads.php.net/pierre/.

It was at about this stage in my quest that I discovered that PHP version 5.3 has intl included as a core extension. So solution #1: upgrade your version of PHP to 5.3+. This is a very valid solution, but it was no good for me because A) it is not backwards compatible so it broke my whole site, B) WebCrate‘s servers are stuck on 5.2 for the time being. One other thing you might think to try is to simply grab the intl.dll from a PHP 5.3 install. I had no luck with this, and resolved that the versions were incompatible.

So is there a happy ending? Not really. I gave up on intl and implemented my own very crude mechanism for localisation which controls the currency formatting on Devex-Templates.

But it’s not all doom and gloom about intl, so on the plus side:

  • Intl installed like a dream on my linux box. (solution #2: get yourself a copy of Ubuntu?)
  • It’s an excellent extension once you’ve got it running.
  • This will all be made irrelevant once version 5.3 is in wider use.
Tagged with: , , , ,
Posted in PHP
One comment on “Installing PHP’s intl extension on windows with PECL
  1. Simon says:

    Your post was helpful, thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">