2
votes

I ran config:cache in my Laravel 5.2 application and this error started showing up.

Fatal error: Uncaught ReflectionException: Class log does not exist in F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php:738 Stack trace: #0 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(738): ReflectionClass->__construct('log') #1 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(633): Illuminate\Container\Container->build('log', Array) #2 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array) #3 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(853): Illuminate\Foundation\Application->make('log') #4 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(808): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter)) #5 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(7 in F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 738

I looked for many solutions. Nothing worked for me.

  • My .env file does not have any spaces
  • I deleted extra packages from my composer.json and ran composer update.
  • I ran php artisan clear compiled many times.
  • I looked for errors in my files but could not find any.
  • I also enabled the mysql extension since I found it somewhere. Then I did a fresh checkout of Laravel 5.2 and now the error is like this.

enter image description here

So, it's not a problem of any config file of mine. Its something else. Any of you have any idea?

2
check your config file, have you edited any config file?Nehal Hasnayeen
+Nehal Hasnayeen I have , but I checked them and did not really find any error. Is there a sure shot way to find out?By running some command or code?Israt Amin Disha
show the code you changed , there is no command to find out, you can use echo or dd() method to check the line where the error has been thrownNehal Hasnayeen
+Nehal Hasnayeen .. I edited my question because I found something about the problem. I am requesting you to read it please.Israt Amin Disha

2 Answers

2
votes

Ok , so I solved it. Looks liek I had multiple issues.

  • In my fresh check out of laravel 5.2, where I was finding error about not having vendor/autoload.php file, I ran in the root directory in command window,

'composer update --no-scripts' , then 'composer update'. That solved the issue.

  • I also had to enable my mysql extension by editing php.ini file.
  • Finally, in my existing project, I actually found a problem in config/app.php. I missed a ',' somewhere. And people, laravel is a disgusting debugger. I miss my cakephp more.

It's a laravel 5 issue. Better to use laravel 4 still

0
votes

Run this command:

php artisan dump-autoload

then composer update