如何在 Ubuntu 14.04中安装 PHP intl 扩展

我有一个困难的时间找到确切的方法来安装在 Ubuntu 14.04的 PHP 内部扩展。

我尝试使用 sudo apt-get install php5-intl,但显示错误 Unable to locate package

我真的需要这个扩展 Zend 框架2,因为上面的缺失扩展,我得到了这样的错误

错误: Zend\I18n\Validator component requires the intl PHP extension

我使用的是 PHP 5.5.9。

如何以正确的方式安装 PHP-intl扩展?

247266 次浏览

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]

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

install it from terminal

sudo apt-get install php-intl

For php 5.6 on ubuntu 16.04

sudo apt-get install php5.6-intl

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!

sudo apt-get install php-intl

then restart your server

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

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

sudo apt install php7.2-intl -y

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.