Reputation: 752
For some inexplicable reason my PHP wont display errors. I have been writing a script that I am now testing and debugging but all I get is a white page even when I stick an echo 1; on line 1. At the top of my document I have the following error overrides to try and get errors to display:
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
error_reporting(E_ALL);
I can't change the global php.ini
file as this would override the settings for other live sites.
Upvotes: 0
Views: 5443
Reputation: 4248
Try to include failing script in another php file like:
error_reporting(E_ALL);
ini_set("display_errors", 1);
include('script_that_fails.php');
EDIT
Short explanation:
If main script contains for example syntax error and environment has error reporting turned off, then even if in main script we'll enable error reporting then it won't success as script won't be executed (because of syntax error). Small trick described above allows to enable error reporting and see the error.
Upvotes: 10
Reputation: 167220
set_error_handler("var_dump");
This function can be used for defining your own way of handling errors during runtime, for example in applications in which you need to do cleanup of data/files when a critical error happens, or when you need to trigger an error under certain conditions (using
trigger_error()
).
Upvotes: 1