Faqts : Computers : Programming : Shopping For You : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 12 people (58%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How can i catch into a variable an error message of a server? for example 404 File not found

Jan 26th, 2009 21:33
katie shein, healthy man, dman, John Burden, Reza A Tabibazar, Goran Sokovic, http://www.ttnr.org


I do not know any direct way of getting the error message into a 
variable. The best method I am using to log those error ( ie puting 
them into a variable ) is to use apache .htaccess file and defining 
custom pages for each error 
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
When an error is issued I can log it into a database or do a search for 
the viewer. 
You may also possibly monitor the server log file for errors, but that 
gets messy realy quick.
---
On Apache, You can use $_SERVER['REDIRECT_URL'] and
$_SERVER['REDIRECT_STATUS'] to get the URL and Error Code
http://www.healthdothealth.com
http://www.healthxhealth.com
http://www.mesotheliomainmesothelioma.com
http://www.healthfirewall.com
http://www.flathealth.com
http://www.healthbodyguard.com
http://ideide-cadouri.blogspot.com
http://gavoride.blogspot.com
http://donsideia.blogspot.com
http://ideeregalo1.blogspot.com
http://partideer.blogspot.com