2017-02-15 145 views
16

我很難找到確切的方法來安裝PHP intl extensionUbuntu 14.04。我試過sudo apt-get install php5-intl,但顯示錯誤Unable to locate package如何在Ubuntu中安裝PHP intl擴展14.04

我真的需要這個擴展爲Zend Framework 2,因爲上述失蹤延伸的我得到錯誤這樣

錯誤:Zend\I18n\Validator component requires the intl PHP extension

我使用PHP 5.5.9

如何以正確的方式安裝PHP-intl擴展?

+2

只是'命令和apt-get安裝PHP-intl' –

+0

@ MASIDDIQUI,還是同樣的錯誤 – Hiranya

回答

37

對於PHP5在Ubuntu:

sudo apt-get install php5-intl 

對於PHP7在Ubuntu

sudo apt-get install php7.0-intl 

反正重啓你的apache後

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!

如果擴展已安裝,則應嘗試啓用它。在php.ini文件或命令行中。

語法:

PHP:

phpenmod [mod name] 

阿帕奇:

a2enmod [mod name] 
+0

我已經這樣做了,閱讀我的帖子 – Hiranya

+0

你以前更新過你的apt庫嗎? – unherz

+0

請注意,從PHP7開始,不再需要版本號si:'apt-get install php-intl'將會起作用。 –

4

可能是宇宙庫被禁用,這裏是your package

啓用它

sudo add-apt-repository universe 

更新

sudo apt-get update 

並安裝

sudo apt-get install php5-intl 
+0

我現在得到'錯誤'現在'php5-intl:取決於:php5-common(= 5.5.9 + dfsg-1ubuntu4)但5.5.9 + dfsg-1ubuntu4.20將被安裝' – Hiranya

+0

看這裏http:///askubuntu.com/questions/661745/why-do-i-get-an-error-trying-to-install-php5-intl –

-1

從安裝終端

sudo apt-get install php-intl