Ubuntu: Enabling the PHP Intl Extension

Bash install PHP 5 Intl ExtensionThe PHP Intl class is really very handy for an i18n site, allowing you to easily output the correct date formats depending on the end users locale.

If you start using it but get an error like this:

Fatal error: Class 'IntlDateFormatter' not found

Then you just need to install the Intl extension.

Fortunately this is dead easy. Just run the following commands

sudo apt-get install php5-intl

You then need to restart Apache

sudo service apache2 restart

You can also check what extensions are compiled in by running

php -m