Forum Moderators: coopster

Message Too Old, No Replies

custom error message

         

MWpro

12:03 am on Jan 31, 2009 (gmt 0)

10+ Year Member



I run a database driven site, and every now and then there is a "Database Error" that brings up the default PHP error page (the page that says cannot connect to database).

My problem is that this error shows the root directory of my site, which I do not want.

Is there a way to make a custom PHP error page to hide this directory information?

coopster

3:21 pm on Jan 31, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yes, there is. Error reporting is a discussion we have quite often here in the PHP forum. In your development environment, error reporting is necessary in order to troubleshoot issues and refine your code. But in a production environment, you do not want to be splashing any cryptic default errors on the display for the user to see, especially when they dump information about where and when the error occurred. You are correct in being uneasy as it is a potential security issue for you.

You can turn off error_reporting [php.net] or better yet, get your production environment configured correctly so that errors are logged rather than pushed back out to the browser: error handling Runtime Configuration [us2.php.net].

coopster

3:51 pm on Jan 31, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Didn't see this duplicate discussion:
[webmasterworld.com...]
this thread now locked