Powered By Blogger

Sunday, 31 July 2011

display PHP errors in My Script Code When display_errors is Disabled

ometimes, your head turns trying to figure out what the problem is with your script. many times when the display_errors if off, you won't have a clue as to what the problem is unless you display the php errors.

this is how the php.ini file would look like:



     Quote:
; - display_errors = Off [Security]
; With this directive set to off, errors that occur during the execution of
; scripts will no longer be displayed as a part of the script output, and thus,
; will no longer be exposed to remote users. With some errors, the error message
; content may expose information about your script, web server, or database
; server that may be exploitable for hacking. Production sites should have this
; directive set to off.

; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = On





copy and paste this code


ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);

No comments:

Post a Comment