| Posted: 17 Feb 2005 15:06 | |
|
Administrator |
Posts: 125 Join Date: Feb 2005 |
|
When developing scripts or software with PHP, PHP's feature to display error messages right in the created page output comes in very handy, because it allows for a very interactive style of programming: after coding a few lines, you can execute the script and see if things work as expected right away.
What is preferable when developing is not desired in production. You do not want your website to display error messages that screw up the output, confuse the user, and potentially impact security. PHP does not only allow you to configure error handling and output (http://www.php.net/manual/en/ref.errorfunc.php), but also allows to set the level of error reporting, even at runtime (http://www.php.net/manual/en/function.error-reporting.php). As a rule of thumb, use the highest possible level when developing. Warnings and Notices can indicate bad coding or potential security problems in your code. When going into production, make sure you suppress the error messages from the output. The easiest way of doing so is to start your script with the line Code:
error_reporting(0); Note: quite often the "interactive" programming style described above results in code lacking good structure, automated tests, and good documentation. Keep in mind that software engineering is not the same as scripting. -- >e-novative> - e-Business Software, Solutions & Services We make IT work for you. http://www.e-novative.de |
|