Fatal error: Class 'NumberFormatter' not found
P粉817354783
P粉817354783 2023-08-16 16:29:06
0
2
575
<p>I've been using this exact same code for ages and never had any problems. Suddenly it stopped working. </p> <p>I read about this problem on the internet and apparently you need to install <code>PHP 5.3 or higher</code>, as well as install the <code>PHP intl</code> plugin. I have both, but whenever I use the function below I still get a <code>Fatal Error: Not found error for class 'NumberFormatter'</code>:</p> <pre class="brush:php;toolbar:false;">function format_item($value) { $format = new NumberFormatter('en_US', NumberFormatter::CURRENCY); return $format->formatCurrency($value, 'AUD'); }</pre> <p>Also, here is part of my <code>php.ini</code> file showing that I have the <code>PHP intl</code> plugin installed: </p> <pre class="brush:php;toolbar:false;">[intl] intl.default_locale = fr_FR ; This directive allows you to produce PHP errors when some error ; happens within intl functions. The value is the level of the error produced. ; Default is 0, which does not produce any errors. intl.error_level = E_WARNING</pre> <p>I also added <code>extension=php_intl.dll</code> in my <code>php.ini</code> and it is also in my directory. </p> <p>Why am I getting this error? </p>
P粉817354783
P粉817354783

reply all(2)
P粉409742142

What you need is:

apt-get install php7.0-intl

No need to change php.ini or do anything else. (Tested on Ubuntu 16.04 with PHP 7).

The most popular answer here is to have you uncomment a .dll file, which will never solve anything unless you are on a Windows server!

P粉237029457

This seems to be a very strange problem, I solved it by:

I upgraded my PHP in Wamp through this tutorial. I also updated the time zone settings in php.ini. When I upgraded it didn't work so I reverted back to the previous PHP version and the problem was solved.

I have absolutely no idea why this solves the problem, but it works for me.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template