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

ChrisF79's avatar

How do I diagnose a 500 Server Error?

Hi friends,

I wrote a sitemap generator and it is working on my local Laravel Valet server. When I put it into production I get an Error 500 server error (running nginx). I look at my storage/logs/laravel.log and nothing is in there regarding the error. How do I diagnose and solve the problem?

Thank you

0 likes
11 replies
ChrisF79's avatar

It wasn't on so I just turned it on. However, refreshing the page that gives the error 500 didn't make any new entry to storage/logs/laravel.log

jlzandrad's avatar

U may need to look on your server logs, php logs, what server are u using?

jlzandrad's avatar

Try adding this to your .env file APP_ENV=local APP_DEBUG=true APP_LOG_LEVEL=debug

Tray2's avatar

500 is almost always due to you as a programmer making a mistake. However if it work in dev and not on the server then you should start by checking that you have the correct version of php on the server and then move on to checking all the path. It could be that the storage path needs to have a symlink.

It would be easier than just guessing if you provided us with the full error message and the code that causes it.

Snapey's avatar

jt can of course be related to no permission to write to the storage folder (hence no log file)

1 like
ChrisF79's avatar

Found my error log (I'm pretty bad at this!). Here is the log:

019/07/16 09:21:16 [error] 31590#31590: *61261 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ReflectionException: Class view does not exist in /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:790
Stack trace:
#0 /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(790): ReflectionClass->__construct('view')
#1 /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(667): Illuminate\Container\Container->build('view')
#2 /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(615): Illuminate\Container\Container->resolve('view', Array)
#3 /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(767): Illuminate\Container\Container->make('view', Array)
#4 /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(1225): Illuminate\Foundation\Application->make('view')
#5 /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Su...PHP message: PHP Fatal error:  Uncaught ReflectionException: Class view does not exist in /srv/www/listingnaples.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:790
Tray2's avatar

Somewhere in your code you are referencing a class called view that does not exist.

Could it be so simple as a little type-o that you have view instead of View when referencing the class? Or maybe you have to add a use clause for it.

ChrisF79's avatar

I checked storage permissions.

drwxr-xr-x  6 chrisfarrugia www-data   4096 Jun 23 12:04 storage

I checked the laravel.log file itself...

-rwxrwxrwx 1 chrisfarrugia www-data 14021733 Jul 16 09:48 laravel.log

I looked at my controllers and route file and cannot find anythign that looks out of place. Plus, I can't figure out why it works locally with Laravel Valet.

Should I delete everything and just clone the folder again from github?

Is this something I can hire for do you think? I could always post a job on UpWork for someone to help.

ChrisF79's avatar

You did it! I literally just yelled "YES!" out loud without thinking. I was afraid I'd have to hire someone to fix it but your link got it. It ended up being permissions. Even though I was changing them myself per other solutions, your link got it done. I must have been missing something. THANK YOU!

Please or to participate in this conversation.