php.ini Settings
There are a few environment-wide settings that should be considered for each type of server you are using to develop your code. First, we will have a brief summary of what these are, and then we will list the recommended settings for each of the three coding environments.
display_errors
An on-off toggle that controls the display of any errors encountered by PHP. This should be set to
0
(off) for production environments.error_reporting
This is a setting of predefined constants that will report to the error log and/or the web browser any errors that PHP encounters. There are sixteen different individual constants that can be set within this directive and certain ones can be used collectively. The most common ones are
E_ALL
, for reporting all errors and warnings of any kind;E_WARNING
, for only showing warnings (nonfatal errors) to the browser; andE_DEPRECATED
, to display runtime notice warnings about code that will fail in future versions of PHP because some functionality is scheduled to be ended (likeregister_globals
was). An example of these being used in combination would beE_ALL & ~E_NOTICE
, which would tell PHP to report all errors except the generated notices. A full listing of these defined constants can be found here: http://www.php.net/manual/en/errorfunc.constants.php.error_log
The path to the location of the error log. The error log is a text-based file located on the server at the path location that records all errors in text form. This could be apache2/logs ...
Get Programming PHP, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.