80

I have a hard time to find exact method to install PHP intl extension in Ubuntu 14.04.

I tried with sudo apt-get install php5-intl but displays error Unable to locate package.

I really need this extension for Zend Framework 2 , because of above missing extension I am getting error like this

ERROR: Zend\I18n\Validator component requires the intl PHP extension

I am using PHP 5.5.9.

How can I install PHP-intl extension in a correct way ?

piet.t
  • 11,718
  • 21
  • 43
  • 52
Hiranya Sarma
  • 1,454
  • 4
  • 15
  • 25

9 Answers9

172

For php5 on Ubuntu 14.04

sudo apt-get install php5-intl

For php7 on Ubuntu 16.04

sudo apt-get install php7.0-intl

For php7.2 on Ubuntu 18.04

sudo apt-get install php7.2-intl

Anyway restart your apache after

sudo service apache2 restart

IMPORTANT NOTE: Keep in mind that your php in your terminal/command line has NOTHING todo with the php used by the apache webserver!

If the extension is already installed you should try to enable it. Either in the php.ini file or from command line.

Syntax:

php:

phpenmod [mod name]

apache:

a2enmod [mod name]
JorgeM
  • 617
  • 5
  • 11
Spears
  • 2,102
  • 1
  • 17
  • 27
  • 15
    Note that as of PHP7, the version number si no more required: `apt-get install php-intl` will work. – Tokeeen.com Nov 02 '17 at 07:12
  • sudo apt-get install php-intl does it automatically for your version – Julian Wagner Sep 20 '19 at 00:33
  • Depends on the version you want. The main repositories are already updated so you have to specify the version if you dont work with th elatest. Also its more fail-safe to specify the version so you always get the same deendencies except you upgrade. Autoupgrades CAN break your system and are pretty hard to find – Spears Sep 23 '19 at 06:50
  • 1
    First run `sudo apt-get update`. Then, `sudo apt-get install php-intl`. It will automatically update php.ini. Then run `sudo systemctl restart apache2` – Supun Kavinda Nov 04 '19 at 03:51
  • "IMPORTANT NOTE: Keep in mind that your php in your terminal/command line has NOTHING todo with the php used by the apache webserver!" - This had me runnning in circles a few years ago, it maddening! – JimmyBorofan Jul 09 '22 at 09:47
22

install it from terminal

sudo apt-get install php-intl
10

May be universe repository is disabled, here is your package in it

Enable it

sudo add-apt-repository universe

Update

sudo apt-get update

And install

sudo apt-get install php5-intl
Alexey Shatrov
  • 450
  • 4
  • 12
7

So, I have problem with it. If you can't install see below. And previously you have to add repository.

  1. sudo add-apt-repository ppa:ondrej/php

2.1) sudo apt-add-repository ppa:ondrej/apache2

or

2.2) sudo add-apt-repository ppa:ondrej/nginx

After that you can install

 sudo apt-get install php7.4-intl

Where 7.4 your php version.

Galaxy IT
  • 696
  • 6
  • 7
6

In Ubuntu 20.04, PHP 7.4 use the following command:

sudo apt-get install php7.4-intl

replace 7.4 with your PHP version

user311086
  • 920
  • 2
  • 16
  • 29
4

For php 5.6 on ubuntu 16.04

sudo apt-get install php5.6-intl
kosala manojeewa
  • 329
  • 3
  • 11
2
sudo apt-get install php-intl

then restart your server

2

This method works for me to install PHP intl extension in Ubuntu 18.04 and nginx

sudo apt install php7.2-intl -y
Bassem Rabia
  • 206
  • 2
  • 7
0

you could search with aptitude search intl after you can choose the right one, for example sudo aptitude install php-intl and finally sudo service apache2 restart

good Luck!