How to Fix “Class IntlDateFormatter Not Found” in Magento 2

One of the most common “hidden” errors developers face especially during a new server setup or a Magento 2 version upgrade is:

Class ‘IntlDateFormatter’ not found.

Let us break down why this happens, how to identify it through practical test cases, and the step-by-step solution to resolve it permanently.

What is the IntlDateFormatter Class?

The IntlDateFormatter is part of the PHP Internationalization extension (intl). Magento 2 relies heavily on this extension to handle:

  • Currency formatting for different regions.
  • Date and time localization.
  • Language-specific string comparisons.

When this extension is missing or disabled in your PHP configuration, Magento’s core logic fails because it can no longer “format” the data it needs to display.

When Does This Error Arrive?

You are most likely to encounter this error in one of the following scenarios:

Fresh Server Setup

You have just pointed your domain to a new VPS or dedicated server. You upload your Magento files, but the moment you run the web installer or access the frontend, the “Class not found” error appears.

PHP Version Upgrade

You recently upgraded your server from PHP 8.1 to 8.2 or 8.3. While the new PHP version is active, the specific intl library was not carried over or installed for the new version.

CLI vs. Web Browser Discrepancy

This is the most confusing case. 

Your Magento frontend works fine, but when you try to run a command like php bin/magento setup:upgrade, it fails. 

This happens because the PHP configuration for the Command Line Interface (CLI) is often different from the one used by your Web Server (Apache/Nginx).

Steps to Fix “Class IntlDateFormatter Not Found” in Magento 2

The solution is to install and enable the PHP intl extension. The commands vary based on your operating system.

Step 1: Verify the Missing Extension

Run this command in your terminal to see if intl is listed:

php -m | grep intl

If the output is empty, the extension is missing.

Step 2: Install the Extension

For Ubuntu/Debian (using PHP 8.2 as an example):

sudo apt-get update
sudo apt-get install php8.2-intl

Step 3: Enable in php.ini

If the extension is installed but still not working, locate your php.ini file (e.g., /etc/php/8.2/fpm/php.ini) and ensure the following line is not commented out:

Ini, TOML
extension=intl

Step 4: Restart Your Services

For the changes to take effect on the website, you must restart your web server or PHP service:

# For Nginx users

sudo systemctl restart php8.2-fpm
sudo systemctl restart nginx

# For Apache users

sudo systemctl restart apache2

Once the extension is active, clear your Magento cache to ensure the system recognizes the environment change:

php bin/magento cache:clean
php bin/magento cache:flush

Pro-tip: Always keep a “PHP Info” file (info.php) handy in your root directory during development to quickly check which extensions are active in the browser versus the terminal.

The Class IntlDateFormatter not found error is a classic “environment gap” issue. It isn’t a bug in the Magento code itself, but a requirement of the server hosting it. By ensuring the PHP intl extension is installed and correctly enabled for both the web server and the CLI, you can resolve this crash in minutes.

Sanjay Jethva

Article by

Sanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for...