Home ยป Error After php artisan config:cache In Laravel

Error After php artisan config:cache In Laravel

Last updated on December 24, 2020 by

Often, developers stuck after running Artisan commands. Here, we will show you how to resolve an error after php artisan config:cache in Laravel. Are you ready? Let’s go then.

Table of Contents
1. How we got error?
2. Solution
3. Alternate Solution

How We Got an Error?

Our team was working on a very large project. The project was hosted in Virtual Machine & Vagrant in local.

At some point, the team wanted to change some configuration in .env file. So they did change and try to verify the change, but they don’t get any effect.

So they google it and found a command “php artisan config:cache” which used to create a cache file for faster configuration loading. But after running that command they got some error as follows. Your story might be different than us and your error might be different. We are listing all possible errors as following.

Error One => Fatal error: Uncaught ReflectionException: Class config does not exist

Error Two => InvalidArgumentException in FileViewFinder.php line 137:
View [welcome] not found.


You can simply run the following command from your command-line tool to get rid of two above mentioned errors.

$ php artisan config:clear

php artisan config:clear is used to remove the configuration cache file. Then you can again run php artisan config:cache command to recreate the configuration cache file.

Alternate Solution

This might be an interesting solution for you. Try this in a situation when you are not able to run the commands.

php artisan config:cache stores cached files in bootstrap/cache/config.php. So you get rename or remove that file. Now, go and test your application. It should be resolved.

That’s it. We hope this post helped you to resolve error after php artisan config:cache in Laravel.

Additionally, read our guide:

  1. Best Way to Remove Public from URL in Laravel
  2. Run PHP Artisan Commands On Shared Hosting Servers
  3. Specified Key Was Too Long Error In Laravel
  4. Active Directory Using LDAP in PHP or Laravel
  5. How To Use The Laravel Soft Delete
  6. How To Add Laravel Next Prev Pagination
  7. cURL error 60: SSL certificate problem: unable to get local issuer certificate
  8. Difference Between Factory And Seeders In Laravel
  9. Difference Between Events and Observers In Laravel
  10. Session Not Working In Laravel

Please let us know in the comments if everything worked as expected or your issues or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you for reading the post ๐Ÿ™‚


Leave a Comment