How to solve the issue - please install the "intl" extension for full localization capabilities
Asked Answered
J

8

18

What i Need

The code i have implemented:

use Symfony\Component\Intl\Intl;
                
\Locale::setDefault('en');
$currencies = Intl::getCurrencyBundle()->getCurrencyNames();

$currency = Intl::getCurrencyBundle()->getCurrencyName('INR');

$symbol = Intl::getCurrencyBundle()->getCurrencySymbol('INR');

$fractionDigits = Intl::getCurrencyBundle()->getFractionDigits('INR');

$roundingIncrement = Intl::getCurrencyBundle()->getRoundingIncrement('INR');
              

Error:

The Symfony\Component\Intl\Locale\Locale::setDefault() is not implemented. Please install the "intl" extension for full localization capabilities.

500 Internal Server Error - MethodNotImplementedException

OS configuration:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.04
DISTRIB_CODENAME=raring
DISTRIB_DESCRIPTION="Ubuntu 13.04"
NAME="Ubuntu"
VERSION="13.04, Raring Ringtail"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 13.04"
VERSION_ID="13.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
Joell answered 28/10, 2014 at 7:29 Comment(3)
What OS (in case of linux, please tell us the distribution) do you run?Capers
i have updated configurationJoell
For Windows OS: see my answer here https://mcmap.net/q/187093/-how-can-i-enable-php-extension-intlZettazeugma
D
26

UPDATED for new versions of PHP:

You can install intl extension for your current php version by this command:

sudo apt-get install php-intl

If you need to install php-intl not only for current selected PHP-version you can pass php version right after php word:

sudo apt-get install php7.4-intl    # for PHP version 7.4
sudo apt-get install php8.1-intl    # for PHP version 8.1

If you use Apache server with mod_php don't forget to restart it:

sudo apachectl restart

Original Answer

You need just put one line to the terminal:

sudo apt-get install php5-intl
Dratted answered 28/10, 2014 at 7:55 Comment(10)
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package php5-intlJoell
try sudo apt-get install libicu48 and then again install intlDratted
bts@bts:~$ sudo apt-get install libicu48 [sudo] password for bts: Reading package lists... Done Building dependency tree Reading state information... Done libicu48 is already the newest version. The following package was automatically installed and is no longer required: kde-l10n-engb Use 'apt-get autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. bts@bts:~$ sudo apt-get install php5-intl Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package php5-intlJoell
Ok. Try do it more manually: pear channel-update pear.php.net pear upgrade PEAR pecl channel-update pecl.php.net pear install intlDratted
bts@bts:~$ pear channel-update pear.php.net PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525+lfs/imap.so' - /usr/lib/php5/20100525+lfs/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0 Updating channel "pear.php.net" Channel "pear.php.net" is up to dateJoell
bts@bts:~$ pear upgrade PEAR pecl channel-update pecl.php.net PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525+lfs/imap.so' - /usr/lib/php5/20100525+lfs/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0 WARNING: configuration download directory "/build/buildd/php5-5.4.9/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir to avoid this warning Cannot install, php_dir for channel "pear.php.net" is not writeable by the current user bts@bts:~$ pear install intlJoell
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525+lfs/imap.so' - /usr/lib/php5/20100525+lfs/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0 No releases available for package "pear.php.net/intl" - package pecl/intl can be installed with "pecl install intl" install failedJoell
You need first to clean your other issues. Disable imap.so and try again.Dratted
No matter your problem in life, there is always an apt-get install solution ;-)Retrace
I have that installed, but it did not solve the problemDynamo
H
17

Extending the Answer by Michael Sivolobov, for php7 on debian 9 /stretch

sudo apt-get install php7.0-intl

or simply

sudo apt-get install php-intl

then

sudo service apache2 restart

Thanks!

Hallett answered 15/11, 2018 at 15:20 Comment(1)
Package 'php-intl' has no installation candidateGeehan
A
8

If you are using XAMPP on windows here is how:

open for example c:\xampp\php\php.ini and remove the semi colon ";" in front of "extension=php_intl.dll" save the file and restart apache.

That will get solve the error message.

Done.

Arapaima answered 18/8, 2017 at 21:12 Comment(0)
K
4

If someone facing this issue in docker mode, for docker instances of php8.x please use this

docker-php-ext-install intl
Kileykilgore answered 31/12, 2021 at 17:46 Comment(1)
Very nice, thx you its work for me !Geehan
C
2

When I tried to install intl on Ubuntu 16.04 with:

sudo apt-get install php5-intl

I've got an error like:

error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works. ERROR: `/tmp/pear/temp/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed

In order to solve the problem I needed to install:

sudo apt-get install libicu-dev

and after that install

sudo apt-get install php5-intl

That solved my problem.

Cheerleader answered 27/12, 2016 at 14:18 Comment(0)
D
1

Open XAMPP server. click on Apache config button And open php.ini file. enter image description here Under php.ini file search intl And uncommented out the line. And restart the server. enter image description here Hope this would be helpful.

Doorknob answered 25/7, 2020 at 9:59 Comment(0)
T
1

For docker image php:5.6-apache this solved the problem for me

So I added these to my config:

  - run: sudo apt-get update
  - run: sudo apt-get install -y zlib1g-dev libicu-dev g++
  - run: sudo docker-php-ext-configure intl
  - run: sudo docker-php-ext-install intl

Reference: https://discuss.circleci.com/t/cannot-install-php-intl-on-php7-2-image/20528/5

Thionate answered 11/6, 2022 at 13:17 Comment(0)
G
0

For docker with fpm it is:

FROM php:8.1-fpm

RUN apt-get install -y libicu-dev
RUN docker-php-ext-install intl

Thanks to https://askubuntu.com/a/243663/739270

Guay answered 9/12, 2023 at 20:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.