Re: display_errors off and custom error pages

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

 





IG wrote:
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();

while (@ob_end_clean());

// and

header('Status: 500 Internal Server Error');

are things you should look at.

also the check the ini setting auto_prepend_file, which can be
set in your apache config so that all vhosts share a common
include file which defines and sets the errorhandler.

also apache has the ability to set a custom handler for 'real'
500 errors. the apache directive is something like:

ErrorDocument 500 /path/to/my/500.php

where the path is a url (or a local path - I think)


   // 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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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