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.
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.
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:
- Best Way to Remove Public from URL in Laravel
- Run PHP Artisan Commands On Shared Hosting Servers
- Specified Key Was Too Long Error In Laravel
- Active Directory Using LDAP in PHP or Laravel
- How To Use The Laravel Soft Delete
- How To Add Laravel Next Prev Pagination
- cURL error 60: SSL certificate problem: unable to get local issuer certificate
- Difference Between Factory And Seeders In Laravel
- Difference Between Events and Observers In Laravel
- 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 🙂