After a couple of weeks of working with PHP 7.4.8 I moved on to PHP 7.4.11 in my Xampp environment, this forced me to install the new version and moving all the projects from the old directory to the new one, however, I didn't copy the same php.ini configuration file in the new version as I thought it would work as expected without so much hassle. Well, it didn't 😆. When I started the project, the following exception appeared on the homepage:
An exception has been thrown during the rendering of a template ("Unimplemented date character "Y" in the format "MMMM dd Y". Please install the "intl" extension for full localization capabilities.").
This started to happen after the implementation of the twig/intl-extra package on the project. Fortunately, the solution is quite simple in any environment, because just as the error describes, you only need to install/enable the intl extension of PHP.
PHP in Xampp for Windows
If you are using PHP in Windows, you will be probably using XAMPP. You can easily fix this error by modifying the default configuration file php.ini located in the PHP directory in xampp:
; c:/xampp/php/php.ini ; Uncomment the intl extension to enable the intl module extension=intl
After uncommenting the line (just remove the semicolon at the beginning of the line), the module should be now active. You only need to restart the Apache and MySQL services and it will work now:
PHP in Ubuntu
In case that you are working directly on the Ubuntu server, you can install the intl extension in the terminal. As first, update the repository:
sudo apt-get update
Then, according to the PHP version of the server, you may install it with the following commands:
# If you are using PHP 5.6 sudo apt-get install php5.6-intl # If you are using PHP 7.0 sudo apt-get install php7.0-intl # If you are using PHP 7.4 sudo apt-get install php7.4-intl
After installing the module, don't forget to restart apache:
sudo service apache2 restart
And the problem should be gone as well in this environment.
Happy coding ❤️!