Is there a way to have PHP
log errors to a file or email me errors INCLUDING $_POST[]
& $_GET[]
and $_SERVER[]
data?
Right now I get a log of PHP FATAL
and WARNING
errors and 404 NOT_FOUND
errors but it's hard to debug some errors without knowing things like user input and the referrer.
Thanks
error_log(print_r($_POST, true));
error_log(print_r($_GET, true));
Put that into a custom error handler and it'll log both for you (the 'true' parameter makes print_r return text instead of outputting it).
You might need to boost the max line length in the error log with log_errors_max_len
, as it defaults to 1024 chars and will truncate everything after that (it won't split >1024 char data across multiple lines).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With