display_errors off and custom error pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've spent the last couple of hours trying to work this out to no avail.

I have recently moved over to a managed dedi server and no can ask my host to change my php.ini.

I have found out that the 'display_errors' in the php.ini is set to off and error file logging is off.

I would like to be able log to file which is easy to do from the ini file but also to show a custom error page if there is an error on one of the pages.

I thought I would be able to use a custom error handler such as -

ob_start();
// custom error handler
function e($type, $msg, $file, $line) {
blah blah
ob_end_clean();

   // display error page
exit();
}

set_error_handler("e");



But all I get is a blank page. Does having display_errors off mean that I can't use a custom error handler? I have also tried adding *set_ini*('*display_errors*','1') but this keeps giving me a blank page.

Can someone tell me the best (and most secure way) of having custom error pages in php. Ideally I would like it all set from a central place so that i only need to change one file for all the websites on our server. I didn't really want to change display_errors to on as I was told this wasn't very secure- i don't want error messages on any of my pages, I just want a simple error 500 server error page.

Many thanks,

Ian

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux