How to make sure server errors are displayed?

I need to test some functions on a real server, and it is obvious that they disabled errors at some global level.

The problem is that I can’t work when I don’t know what the error is. How can I make sure that exceptions are displayed, not just 500.

I tried putting these two lines at the top of my script, but it is still empty.

<?php

ini_set('error_reporting', E_ALL);
error_reporting(E_ALL);

throw new Exception('Fatal Error'); // nothing is outputed
+3
source share
1 answer

The two lines are very identical, so delete one of them.

You also need ini_set("display_errors",1);to actually display errors.

Note that this will not work for syntax errors in the current file, as they occur in the parsing phase before all statements are executed.

+2

All Articles