Tag search

Howto: build and install the intl PECL extension for PHP5 in Debian

by Sander Marechal

For the past few days I have been looking for a proper i18n (internationalisation) and l10n (localisation) method for PHP. PHP has quite a few locale aware functions such as strftime and sprintf. In combination with gettext this can work quite well. The major downside is that you need to install all the locales that you want to support on your server. Want to serve your websites in Russian? Then you need to generate a Russian locale system-wide. That won’t work when you’re on a shared hosting account somewhere.

PHP6 is promising to solve that problem with the intl functions. Even better, the intl functions are also available as a PECL extension and works on PHP 5.2.4 and newer. Debian Etch currently packages PHP 5.2.0 which is too old, but Lenny—Debian’s upcoming version—is up to PHP 5.2.6. There is no package (yet) for php5-intl in Debian Lenny but building and installing the extension yourself is really easy. Here’s a short tutorial.