How to debug Laravel error 500 with no logs, no information

Viewed 45914

I'm working on an existing Laravel application in order to develop new feature but after installing the app on my computer, I have an error 500 and no clue to resolve it.

In my app.php file I have set :

'env' => env('APP_ENV', 'local'),
'debug' => env('APP_DEBUG', true),

But still I have no information, no logs are generated in storage/logs . I have no idea of what could be the problem.

The previous developer was on windows and I'm working on Linux but I'm not sure this is revelant.

EDIT:

I also have those variable in my config/app.php

'log' => env('APP_LOG', 'daily'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
7 Answers

Some PHP exceptions are not possible to catch, so Laravel cant handle them. For example syntax errors, or maximum memory limit errors.

The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.

Ref.: http://php.net/manual/en/function.set-error-handler.php

I had simiar issue (saw error 500, but logs were present).

In order to be able to see errors directly on the page, I did following changes:

  1. enable debug mode: APP_DEBUG=true
  2. reload configuration: php artisan config:cache

I tried to everything to find out the issue like enabling error reporting to report all like :

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Also i tried to add my custom error handler as well but nothing worked for me. So finally i found the actual issue in php error log file in apache error logs folder (Applications/MAMP/logs as am using Mac).

Check your .htaccess file in your public folder! - This hot-fix is host dependent!!!

Change line from:

RewriteRule ^ index.php [L]

To:

RewriteRule ^ /index.php [L]

If you still getting same after trying all of the above solutions, same was here !!. Finally found solution using apache log.

Check apache log by

tail -f  /usr/local/apache/logs/error_log

If you can see something like '...index.php is writable by group'. then change permission

chmod 0644 public/index.php

I had this issue, and setting debug on told me the true issue.

For me, it was permission related, the running process didn't have permission to write to the log files, very hard to debug when the files you are relying on to tell you the problem don't arrow write!

Related