V
V
voproser2021-01-23 21:59:26
Laravel
voproser, 2021-01-23 21:59:26

How to debug if display_errors doesn't help?

The problem is to debug. Project on Laravel. The script works with HTTP Error 500. I found a problematic line, but only with the help of die; . If you put die in front of it, the script works out, after - the site goes down. But that's the question, I can't find out what the problem is because
If you put

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

does not work. I add these three lines at the beginning of index.php, the script still fulfills HTTP Error 500 and does not show the problem itself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton October, 2021-01-23
@samnebudu

as an option to wrap the problematic block of code

try {
  // проблемный код
} catch (\Throwable $exception) {
  \Illuminate\Support\Facades\Log::error($exception);

  return response()->json($exception);
}

and try to see what's what, it can just be displayed on the screen, but the main error should be saved in the logs, and in the logs you can already see in more detail.
Logs in Laravel projects are stored in this way project/storage/logs/.. and here are the log files.
Also look in the .env file (located in the root of the project) for the following parameters to have the following values:
APP_DEBUG=true
LOG_CHANNEL=daily
LOG_LEVEL=debug

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question