PHP Error Recording

software development

#1

Let me start by saying that I am both new to DH and new to PHP. So far, I have figured out how to hook PHP to MySQL, built my PHP pages, and created a manual log by piping my form data to it before inserting in database.

But, what I want to know is how to have any PHP or mysql errors go to a log file instead of the user, and have the error redirect to a nicer page on my site. Does that make sense? Any advice will be appreciated. My old host had an entire section that you could go to to see server errors like when debugging perl, but I haven’t found the same here on DH.


#2

You can build your PHP applications in such a way as to shunt possible errors to wherever you wish. Study the error_log() function for more details.

Custom error messages are usually handled by placing directives in your .htaccess file; however, DreamHost also offers an easier solution. Learn more on this page of the DreamHost Wiki. Personally, I prefer the editing my .htaccess file so that I can do PHP-based error messages.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]