Joriz

Active Member
Aug 11, 2004
32
0
156
the Netherlands
cPanel Access Level
DataCenter Provider
I want to put display_errors off in PHP so visitors dont see errors on a website made by customers in their website.
I think this is a lot safer then showing all those errors on screen to a visitor.

But when I turned it off I found out that customers cant view the errors there self in the cPanel Error Log.

I use PHP 5.20 with phpsuexec

Normally the error part in the php.ini is configured like this:

Code:
; Examples:
;
;   - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE
;
;   - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
;
;   - Show all errors except for notices
;
error_reporting  =  E_ALL & ~E_NOTICE

; 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

; Even when display_errors is on, errors that occur during PHP's startup
; sequence are not displayed.  It's strongly recommended to keep
; display_startup_errors off, except for when debugging.
display_startup_errors = Off

; Log errors into a log file (server-specific log, stderr, or error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
log_errors = On                  ;

; Set maximum length of log_errors. In error_log information about the source is
; added. The default is 1024 and 0 allows to not apply any maximum length at all.
log_errors = On                  ;

; Do not log repeated messages. Repeated errors must occur in same file on same
; line until ignore_repeated_source is set true.
ignore_repeated_errors = Off

; Ignore source of message when ignoring repeated messages. When this setting
; is On you will not log errors with repeated messages from different files or
; sourcelines.
ignore_repeated_source = Off

...

; Store the last error/warning message in $php_errormsg (boolean).
track_errors = Off
So my question is if there is any way to show the php errors in the Cpanel Error log and not in the browser when someone visits a website with bad coded PHP?
 

mctDarren

Well-Known Member
Jan 6, 2004
665
8
168
New Jersey
cPanel Access Level
Root Administrator
But when I turned it off I found out that customers cant view the errors there self in the cPanel Error Log
In the snippet of your ini file I don't see where you declare the error log file name - you should have something like this:
Code:
error_log = error_log
Which will log errors to a log file called "error_log" in the user's directory where the error takes place. Not sure, but I think the error log in cPanel supplies Apache errors, not php logic or code-based errors.
 

mctDarren

Well-Known Member
Jan 6, 2004
665
8
168
New Jersey
cPanel Access Level
Root Administrator
I see what you mean - you want them to be able to log in to cPanel and see the errors there. It will still have to log it somewhere. IMO, if the user isn't saavy enough to download and read an error log they probably shouldn't be writing PHP scripts in the first place. ;)