Home » Php » php – Symfony\Component\Debug\Exception\FatalErrorException laravel Error

php – Symfony\Component\Debug\Exception\FatalErrorException laravel Error

Posted by: admin April 23, 2020 Leave a comment


I am getting this error on my new Laravel project. I am trying to run after a fresh installation.

Declaration of
must be compatible with

How to&Answers:

On my server following were configurations:

PHP 7.1.26-1+ubuntu14.04.1+deb.sury.org+1
Laravel Framework 5.7.28

"symfony/translation": "4.3.8" in composer.json as follows

"require": {
     "symfony/translation": "4.3.8",

and then

composer update

or (if php version is not recommended on the server)

composer update –ignore-platform-reqs


I got the same error on PHP 7.2.3 after composer update (symfony\translation v4.3.8 => v4.4.0).

I solved this issue with "symfony/translation": "4.3.8" in my composer.json.

It’s a bad idea to hard edit vendors files.


Symfony doc says Install PHP 7.2.5 or higher, so if you don’t want to add this restriction into your composer.json file, you can upgrade your PHP version to 7.2.5+ (check others libraries compatibility first).


I got the same error today and I solved it with a little editing. Just do this:
Navigate to


and delete string keyword from the setLocale() function.

If you get this error after this:

Declaration of Symfony\Component\Translation\Translator::trans($id, array $parameters = Array, $domain = NULL, $locale = NULL) must be compatible with Symfony\Contracts\Translation\TranslatorInterface::trans(string $id, array $parameters = Array, ?string $domain = NULL, ?string $locale = NULL)

Just navigate to:


and delete all the string keywords from the trans() function


If you don’t want to edit vendor files, you can use this:
Open your composer.json file, and add this in "require"

“symfony/translation”: “4.3.8”,

Then open your terminal and type this:

composer update


It is not a bug.

The latest version of symfony packages requires PHP version to be at-least 7.2.5

Change the PHP version to 7.2.5 or greater and it should work.


I found simple solution to this problem after roaming google so long. If it could help someone. Upgrading your PHP Version to 7.2 or more

 1. sudo a2dismod phpX(X is less than 7.2 version) 
 2. sudo a2enmod php7.2(could be greater than or equal to 7.2)
 3. service apache2 restart

Following these steps should help you getting rid of this issue


On my server following were configurations:

PHP 7.2 Laravel Framework 6.*

Solution: Added “symfony/translation”: “4.3.8” in composer.json as follows

"require": {
     "symfony/translation": "4.3.8",

and then

composer update