Magento 2 Fatal error: Class ‘Locale’ not found in DataBundle

I have just installed magento 2 on my new server and everything was working fine. Frontend and backend both were looking fine but when I tried to run  this command to clear the cached files or even indexer command it was giving fatal error:

php bin/magento setup:static-content:deploy
PHP Fatal error: Uncaught Error: Class ‘Locale’ not found in /var/www/vhosts/myproject/httpdocs/vendor/magento/framework/Locale/Bundle/DataBundle.php:64

And also when I tried to run indexer command it throws the same error

php bin/magento indexer:reindex

So lets move to the solution, it normally occurs if You php do not have intl extension. You can verify it by run php -i.

So to install INTL on your server login to ssh and then type:

For PHP7 on ubuntu

sudo apt-get install php7.0-intl

After that restart you apache server

sudo service apache2 restart

You are done, now run indexer command again and your issue should be resolved.

Leave a Reply

Your email address will not be published. Required fields are marked *