Forum Moderators: phranque

Message Too Old, No Replies

AGAIN custom errors, this time generating 500

Generate custom 500 when a program cannot recover from an error

         

Juanse

8:28 am on Jul 28, 2003 (gmt 0)

10+ Year Member



Dear all,

Again I find myself inside the custom error pages:

What I want:

-Generating a custom error page for 500 (ok)

-User programmes going to a 500 page when
a logical error is produced i.e. unsucessfull query execution from which php programme can't do anything

-bots, browsers, apache, knowing this fact

What I have

with:
header('location: error500.php') you get the 302 and go in for my error500.php

with:
if ($error)
header('Status: 500 blah blah...')

you get the 500, (even if you've written something: not getting the headers already sent(?)) but since it is not a real 500 (I forced it) apache doesn't notice nor error500.php redirect happens

Thanks people,

p.s.: Any other ideas are welcome about an standard error
processing system usefull to bots, logs and users

claus

11:46 am on Jul 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



well, you could just use your .htaccess file and insert lines like these:

ErrorDocument 500 /err/500.php

- then put your error handling script in the "err" folder and exclude it using robots.txt if that's appropriate (i would suggest outputting a "meta robots noindex,follow" as part of the php page in stead.)

Just add the line from above to an empty ascii txt file, upload it to your homedir and name it ".htaccess" (including the dot).

/claus

<added>
hrm... i did not pay attention to this part:
>> since it is not a real 500 (I forced it) apache doesn't notice

- the above will not work then, sorry about that.
</added>

Juanse

12:13 pm on Jul 28, 2003 (gmt 0)

10+ Year Member



Thanks (^upper guy) I know how to create custom pages - I learnt it here!

I think it's important to show an error page to the end user. Newbie users to the internet - belive me, they exist -
don't belive db updates really commit. I want them to trust my website in the following way: If I say no error occurred in the transaction u requested, please belive me, otherwise, I will notice webmaster by an email alert, and things will be checked..., This shows a lot more professional site (and it shoud be easier for the developers).

Now this output its done on a non-standarized way inside the error page using a dbman.class wich handles errors.