`
PHP Fatal error: Uncaught ReflectionException: Class config does not exist in /var/www/agc_club/api/vendor/laravel/framework/src/Illuminate/Container/Container.php:752
Stack trace:
`
I updated the system step-by-step from 5.2 to 5.5. First, from 5.2 to 5.3, then from 5.3 to 5.4, and finally from 5.4 to 5.5. Unit and integration tests were successful. But when I tried to access the site through the browser, any page gave me error 500.
In the log of Laravel there is nothing about it, but the log of Nginx gave me the above information. Looks like Laravel can't resolve its config.
When I change the git branch back to 5.2 and reinstall the vendors, everything works fine, so it's not enviroment problem.
There's usually a problem in your code that prevents the application from properly booting up, you need to revise your code and seek help on the forums.
One reason for such behavior would be if you had used middleware with a name "ConfigMiddleware" on the current route. Solution would be to go to Kernel.php and add
'config' => \App\Http\Middleware\ConfigMiddleware::class
I had the same problem! For those whom might have this problem, the issue for me was with the .env
file, values with space must be wrapped with double cotes like this APP_NAME="APP NAME"
insted of this APP_NAME=APP NAME
note the double cotes
Thanks to isneezy for suggestion fixing my problem
This solved my issue (isneezy's solution)
Run php artisan config:cache
solved it for me.
Or if you are on shared hosting without access to the Terminal/CMD, add this to your Routs.php
file:
Route::get('/config-cache', function() {
Artisan::call('config:cache');
return '<h1>Config cache cleared successfully</h1>';
});
Then go to yourdomain.com/config-cache
I had the same problem! For those whom might have this problem, the issue for me was with the
.env
file, values with space must be wrapped with double cotes like thisAPP_NAME="APP NAME"
insted of thisAPP_NAME=APP NAME
note the double cotes
my app name is in double coats but still i am getting this error, what should i do?
@umer1o9 Have you tried my solution?
@Idomo yes i tried but error is still there.
@umer1o9 Make sure that you鈥檝e wrapped all of the values in the .env
file, also the database info and all of the values that contains some special characters (like @&$).
For those still facing the same problem, what solved for me was: remove all contents of the bootstrap/cache folder, and run the composer dump command
I'm having trouble with this when it comes to unit testing. It's not all the time, this happens randomly while I'm testing.
The only solution for me was like @Samuel-Bie says to delete the bootstrap/cache folder files and run the composer dump-autoload command. Sometimes the command php artisan config:clear also works.
The problem is that it only works once, and when I run the tests the problem appears again.
If anyone knows a definitive solution to this, it would be great.
For those still facing the same problem, what solved for me was: remove all contents of the bootstrap/cache folder, and run the composer dump command
I spent way longer than I'd like to admit flushing the wrong things before I tried this.
Most helpful comment
I had the same problem! For those whom might have this problem, the issue for me was with the
.env
file, values with space must be wrapped with double cotes like thisAPP_NAME="APP NAME"
insted of thisAPP_NAME=APP NAME
note the double cotes