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

isbkch's avatar

all Artisan commands return error after cache clear

Hi,

On Laravel 5.1 I run php artisan config:clear I got the message saying that the operation went successfully but then all other artisan commands start returning:

PHP Fatal error:  Cannot redeclare class Illuminate\Contracts\Config\Repository in /var/www/app/config/vendor/illuminate/contracts/Config/Repository.php on line 5

I haven't changed anything else, does anyone know why and how to fix this ?

0 likes
3 replies
defayeke's avatar

You'll probably have a file now generated in bootstrap/cache/config.php which is being referenced for your settings. But this will be broken as you're likely referencing environment variables directly from your app. I'm not sure how the cache works but it seems as if unless you've declared the variables you need in the Laravel PHP config files (which themselves can happily load directly from the .env file) you will run into this problem. So the quick fix would be to remove the config.php (or rename to .backup.php temporarily to test) and see if this fixes things. Then rework the way you are referencing settings in the app, and try caching it again afterwards - you most certainly don't want to encounter this problem on a production environment! Especially when doing this seems to knock out the use of artisan.

1 like
Hash's avatar

@defayeke removing config.php from bootstrap folder solved the issue for me. Thanks :)

wikinopi's avatar

Avery just felt that they were different from other people even when they were in kindergarten, first and second grade. The psychologist noted that the fear of nightmares that Avery experienced, are typical for young children, but https://gaypornvideostube.com/en/category/4294967334/Crossdresser/popular/1/ Avery kept things to themselves and didn't tell their problems to anyone. However, the psychologist was able to read Avery very well and was very kind and understanding with them and recommended that Avery sleep with them for the time being to get their mental energy and happiness back and even encouraged their parents to tickle Avery to bring joy.

Please or to participate in this conversation.