-
Notifications
You must be signed in to change notification settings - Fork 150
Example Setup
JosephLenton edited this page Jun 28, 2012
·
9 revisions
These are a number of different example on how you can setup and run PHP Error. They aren't the only way, but you can just copy and paste if you want to get going quickly.
The current version of PHP-Error can be found here.
In all cases, 'display_errors' must be set to 'On' for PHP Error to work. This is a safety feature.
- Place php_error.php into your project
- At the entry point of your site add ...
require('php_error.php');
\php_error\reportErrors();
- Place php_error.php somewhere on your PC, for example: C:\php\php_error.php
- open your php.ini file
- find 'auto_prepend_file'
- set it to auto prepend php_error.php
- add the option 'php_error.autorun = On'
auto_prepend_file = "C:\php\php_error.php"
php_error.autorun = On
- Place php_error.php somewhere on your PC, for example: C:\php\php_error.php
- open your php.ini file
- find 'auto_prepend_file'
- add 'php_error.php' to this file
auto_prepend_file = "C:\php\php_error.php"
- find the entry point to your project
- run 'reportErrors' if php_error is loaded (so in production this silently fails)
if ( function_exists('\php_error\reportErrors') ) {
\php_error\reportErrors();
}
But you can forcefully shut it down globally by:
- open php.ini on your production server
- add the option 'php_error.force_disabled = On'
php_error.force_disabled = On
Alternatively:
- open php.ini on your production server
- set display_errors to 'Off'
display_errors = Off
Either of these will cause PHP Error to silently do nothing.