Re: display_errors off and custom error pages

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

 



Thanks, Chris.

chris smith wrote:
On 4/29/06, IG <php@xxxxxxxxxxxxxxxxxxxx> 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();

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


The *s got into the email for some weird reason- they aren't in the original code. I would like an error page to be displayed for all errors including parse ones. Blank pages aren't that helpful for the user.

Sounds like a parse error (using the code above will give you that).

Try it in a htaccess file:

php_flag display_errors 1

(I think).

You can't use ini_set because a parse error breaks the whole script
and it's not executed, so you need to change this value before the
script.

Do I have to have display_errors set to 1 if I want to display a custom error page? I'd rather have display errors set to 0 but have a custom error page displayed when an error is triggered. Is this possible? Perhaps I have misunderstood how errors work in php.



--
Postgresql & php tutorials
http://www.designmagick.com/


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