Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

clat23's avatar

Symfony and PHP? Getting an error, please help.

I am getting 11 entries of this error in my log for every page load:

Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) {"exception":"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 64): Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) at /home/forge/contactele.com/vendor/symfony/translation/TranslatorInterface.php:24)

As you can imagine, my log gets very large in size rather quickly. I am getting this error after updating my Forge server to 7.2 (7.2.26 to be exact). I updated PHP from 7.1.4 to 7.2 because I pushed code that required PHP > 7.2 i am running Laravel Spark (I believe the Laravel version that Spark is using is 5.6).

I found this solution: https://stackoverflow.com/questions/58975559/symfony-component-debug-exception-fatalerrorexception-laravel-error

I tried the solution by adding this to composer.json:

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

Then running composer update but that results in this error:

Loading composer repositories with package information
Updating dependencies (including require-dev)

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 692068352) (tried to allocate 16777216 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129

Fatal error: Out of memory (allocated 692068352) (tried to allocate 16777216 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129

Any help would be appreciated.

0 likes
2 replies
clat23's avatar
clat23
OP
Best Answer
Level 3

Thanks for your attempt to help @jlrdw but it looks like I had a different issue.

First off, it was a mis-statement when I said I was getting 11 entries of the error I showed above for each page load. I actually had 2-3 of those error entries for every second. My log files grew in size very quickly.

When I checked my worker status in Forge, I noticed there were 14 queue workers running when I had only configured 10. So I deleted all of my queue workers in Forge and noted 4 remaining.

I then followed my own solution to another problem here: https://laracasts.com/discuss/channels/forge/how-to-manually-terminal-command-delete-queue-workers

This removed all of my queue workers from the server. I checked the logs and no more ongoing Symfony errors. I then performed a composer update as mentioned above and no longer did it result in errors.

The only thing I can think of is that while I was doing an update to PHP on my server, job(s) were being performed by queue workers.

Anyway, this problem is solved.

Please or to participate in this conversation.