9 Handling and Avoiding Errors You will probably (Geocities web hosting)

9 Handling and Avoiding Errors You will probably be spending a fair amount of time contemplating errors in your code, as do most Web developers when they start programming. No matter how good you are, how well you code, how long you have been coding, or how hard you try, you will encounter times when you have errors in your code. It is of the utmost importance that you know how to handle your errors and debug your own code. Being able to efficiently and properly debug your code is an invaluable time-saver; and in Web development, $time == $money! Luckily, PHP comes with a full-featured Applications Programming Interface (API) that provides you with many ways to trap and resolve those unwanted errors. PHP also allows you to use the API to capture the errors and create your own custom error functions or pages. These features are useful when debugging your code and when notifying your Webmaster about errors that seem to be happening to your applications as users are running them. Not only can you use PHP code to trap errors and customize them; you can use the Apache Web Server to help do this. How the Apache Web Server Deals with Errors Apache has a directive, the ErrorDocument, that you can configure in the httpd.conf file to create custom error pages with PHP so visitors to your site don t see the old, boring, server-created error pages. You have limitless possibilities when creating these custom messages. As with the PHP error-catching pages, you can have the ErrorDocument call PHP pages to do whatever you would like them to do from simply displaying a friendly error message to the user to e-mailing a system administrator to notify him or her of the failure. Unlike PHP error pages, the Apache ErrorDocument pages are used more for instances of missing pages (that is, a Page Not Found error or Forbidden access error pages and other requests of that sort). So, if someone visits your site, and he or she runs into the Page Not Found error page,
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Leave a Reply