Fatal error: Class 'IntlDateFormatter' not found
Asked Answered
Q

7

46

I installed WAMP on my local machine. My PHP version is 5.3.3 in phpinfo() but that extension doesn't exist! :(

How can I install this extension without compiling it? Here is just source of it.

Quality answered 5/6, 2011 at 10:38 Comment(1)
Read this: https://mcmap.net/q/239061/-intl-extension-installing-php_intl-dllIndecipherable
Q
79

The extension was there! All you need to do is clearing the comment(;) before this line in php.ini file:

Windows:

;extension=php_intl.dll

to

extension=php_intl.dll

Linux:

;extension=intl

to

extension=intl

Then restart apache2 or php-fpm if you are using it.

If it does not work, then you probably need to change it in the php.ini of the CLI version. First check your version with php --version though, so that you change the right php.ini file, it might be different from your php fpm version.

It also might be enough to just install the package e.g. for php 8.2: sudo apt install php8.2-intl

Quality answered 5/6, 2011 at 11:1 Comment(4)
and don't forget to add C:\xampp\php to your system path if you are using XAMPPGardie
I had the same issue, but even when I uncommented this line - module wasn't loaded properly (no errors in php/apache logs). So please be sure that version of module is correct for the current php version :)Brecciate
In my case it was extension=intlGirlish
If it does not work, then you probably need to change it in the php.ini of the CLI version.Porker
F
38

if you see this on Debian / other Linux platforms.

sudo apt-get install php5-intl - for PHP 5.6

sudo apt-get install php7.0-intl - PHP 7+

Amazon Linux

sudo yum install php70-intl

After that restart Apache services.

sudo service apache2 restart restart apache to get the changes.

Fabianfabianism answered 4/6, 2018 at 3:12 Comment(3)
This one is the right answer on Ubuntu/Debian environments, not the one already marked as correct answer. Please go with this method to next problems.Griqua
but the question was asked for WAMP :)Fabianfabianism
in amazon linux is actually: sudo yum install php70-intlReplevy
C
5

in wamp or xampp open php.ini file and find the below line, then remove comment (;) at first of it:

;extension=php_intl.dll

if you did not find the line, add it in the php.ini file:

extension=php_intl.dll

Call answered 28/7, 2021 at 14:58 Comment(0)
E
4

It may be because of Apache. Restart Apache by following command

service httpd restart 

and try again.

Enumerate answered 18/6, 2014 at 12:2 Comment(0)
U
1

If you added extension=php_intl.dll in your php.ini and it didn't work you can copy icu****.dll files (about five of them) from PHP folder to Apache /bin folder then restart Apache and try again.

Unpaid answered 25/2, 2023 at 8:34 Comment(0)
C
1

The following command works like a charm:

sudo apt install php8.2-intl
sudo /etc/init.d/apache2 restart
Calculable answered 13/10, 2023 at 6:19 Comment(0)
B
0

If you are creating a software package for deployment on systems you don't manage, there is an alternative to editing php.ini. You can use the Symfony version of IntlDateFormatter. With some editing, this can be modified to run in your application.

Note: this solution only makes sense if you cannot edit php.ini (and if necessary copy the ICU files into Apache). Otherwise, the "with some editing" portion of this makes the whole thing more complicated than just enabling intl. Putting this answer here, as this is the earliest question asking about the relevant error.

People who find this useful should upvote this answer to How to use IntlDateFormatter in Symfony?. That provided an important missing step.

Balzer answered 10/4, 2023 at 0:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.