redfox9999
redfox9999

Reputation: 37

Htaccess manipulation error log and redirect 503 if php has error

This is my error display.

Fatal error: Call to undefined function test() in C:\wamp\www\test.php on line 3 Call Stack: 0.0788 241120 1. {main}() C:\wamp\www\test.php:0

But i want like this.

[Wed Oct 01 15:07:23 2008] [error] [client 76.246.51.127] Call to undefined function test() in C:\wamp\www\test.php:3

How can i do it with .htaccess not php or php.ini file and i want redirect to error/503.php if php have error.

Upvotes: 1

Views: 205

Answers (1)

vard
vard

Reputation: 4136

As far as I know you can't handle it with a .htaccess. Why can't you use PHP for handling that ? With PHP5.2+ you can catch fatal errors with register_shutdown_function :

register_shutdown_function('fatal_errors');
function fatal_errors()
{
  // do stuff
}

See http://php.net/manual/en/function.register-shutdown-function.php

Upvotes: 1

Related Questions