O'Reilly logo

Programming PHP, 3rd Edition by Peter MacIntyre, Kevin Tatroe, Rasmus Lerdorf

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; and E_DEPRECATED, to display runtime notice warnings about code that will fail in future versions of PHP because some functionality is scheduled to be ended (like register_globals was). An example of these being used in combination would be E_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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required