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

godcode's avatar

Laravel 5.4 error on Production Server but error.log shows nothing.

Hello,

My boss recently called be that he encountered the 'Oops something went wrong page' after logging in to our website made with Laravel 5.4. He was able to replicate it one more time just enough for me to see the error page. Since its the production server, the APP_DEBUG is turned off so I am reliant on our error.log to check what caused the error. The problem is, the error.log did not have a log on that particular encounter.

I would like to know if where else can we check for errors aside from the error.log found in /var/log/nginx? or did I missed out a log configuration?

0 likes
11 replies
ftiersch's avatar

Laravel Errors are saved in your laravel directory in storage/logs . If you see the oops message it's quite possible that your error would be there, not in the nginx error logs

godcode's avatar

Hi ftiersh,

I have checked that folder too, but, there is no error log there. This are the logs found in storage/logs:

  1. cronlog.log
  2. schedule-*.log
  3. supervisord.log

Do we need to have errorlog activated? in my config/app.php there is already an entry: 'log' => env('APP_LOG', 'errorlog'),

but it doensn't seem to work. Even in my local xampp test server, the errorlog file is empty.

Update: I just added errorlog on the production server , just in case: -rw-r--r-- 1 www-data www-data 0 Apr 7 07:26 errorlog

ftiersch's avatar

Usually you shouldn't need to add something. Depends of course how you configured your laravel but usually there should be a laravel.log in that folder for errors.

godcode's avatar

my laravel has default settings for the log. but not really sure why it did not have the errorlog. this was never an issue until today, when an error did not save in the nginx log directory.

anyways, i'll continue to research or investigate this issue.

thanks @ftiersch for the assist.

Snapey's avatar

make sure you understand. In the project's storage/log folder

You should not expect to see other log files there.

Incase this project was setup by someone else, you should check the production laravel config files for the log settings

godcode's avatar

Got it. I am rechecking now the config files. I actually was the one who setup the server. just followed some guide i found on the net but forgot how i setup the log or even the link to that guide.

btw, my issue is not that the logs are not working at all, but only that there was this instance that we encountered an error but the error details was not on the error logs in /var/log/nginx/error.log. I tried intentionally causing an error on the server by trying to query a non existing table via DB::select and the error detail got logged. this is the first line of the error: 2019/04/07 08:27:49 [error] 1999#1999: *4965131 FastCGI sent in stderr: "PHP message: [2019-04-07 08:27:49] local.ERROR: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxx.blog_post_categoriez' doesn't exist in /var/www/my-website/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:61

Snapey's avatar

Errors that are caught by laravel are not going to show up as nginx errors because as far as nginx is concerned the request ran fine. Its only the user that can see the response was an error page.

You need the Laravel logs to see APPLICATION errors

godcode's avatar

Snapey, when doing a app('log')->log('critical', 'Hello World!');, should the log be in the Laravel log that you are talking about? because mine shows up in /var/log/nginx/error.log.

anyways, i have run out of ideas about this issue. I think I'll just put it aside for now. Maybe I just need to rest my mind.

Thank you guys for the assist.

godcode's avatar

ooyy!!! i think i got the error logs to log in laravel.log!!! what i did was replaced 'log' => env('APP_LOG', 'errorlog') with 'log' => 'daily' and the log suddenly created itself. i think we're on the right track. hopefully when the error I encountered before that did not save on the log will now be logged when it reappears again in the future.

godcode's avatar

apparently, the issue is still not fixed. however, I may have replacated the error myself and found a potential cause of it though.

I encountered an error on my code:

if ($company->user_id == Auth::user()->id || $company->membership()->access_level >= 1) {

that line of code just simply checks if the current user is the owner of the company or if he is a member of it. but i forgot to add a null trap (!empty($company->membership())) which throws an error if the user is not a member of the company. and then i realized whenever that happens, the error never gets logged. anyways, i just added the null pointer checker to fix the issue.

Friendifie's avatar

Bump

I’m experiencing issues too. I’ve tried everything to get Lumen to run on my web-host but it’s being difficult. It’ll run the index root (/) route but every route after that (/status, etc.) it won’t. I get the “Sorry, the page you’re looking for could not be found.” error. I’ve moved my “/public” into my “/“ as suggested when publishing but nothing works.

Please check out my post to help resolve my issue.

https://laracasts.com/discuss/channels/lumen/lumen-works-on-shared-web-host-but-isnt-working

Please or to participate in this conversation.