Error Handling in PHP

Delicious Delicious

How to Display a Custom Error Page in PHP ?

It is better to store error messages in log files instead of displaying to users.

Settings to be done in php.ini configuration file.

1) Set display_errors to off.

     display_errors = Off

Logging errors into a log file in PHP

You can create a log file in which all the errors occured can be stored for further reference.

Insert following code in each PHP page where you want to display custom error page.

function myhandler($eno,$edesc)
echo "Detail: $edesc <br/>";


font: 8pt/11pt verdana;
<title>Ohh! Error Ocurred. </title>
<div style="border:solid #999;background:#ccefff;width:400px;height:100px">
<h3><span style="COLOR: red; FONT: 18pt/21pt verdana">! Opps </span> The page cannot be

<a href="">Home Page--> </a>

No comments:

Post a Comment

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog