Log with PHP Errors for All Accounts?

jazee

Well-Known Member
Jan 12, 2015
119
4
68
cPanel Access Level
Root Administrator
I just switched all my accounts from running PHP 5.6 to PHP 7.3. I've not detected any issues from the user side (yet). Is there a log I can look at somewhere to find if any accounts' scripts are generating critical E_ERROR level (and E_WARNING would probably be good to see too) for all accounts. Or do I need to examine the PHP error log in all the directories where PHP is being executed from?
 

jazee

Well-Known Member
Jan 12, 2015
119
4
68
cPanel Access Level
Root Administrator
Trying to answer my own question (LOL) this is the best technique I've come up with.

Delete all the error_logs

find /home -type f -name error_log -delete

Then check to see what error_logs are being written too and then go examine the content

find /home -type f -name error_log

I'm curious if there is a WHM setting to limit the account PHP error_log sizes to prevent things from potentially getting out of hand (especially during a PHP version upgrade) or are we left to manage these manually?
 

Chi.C.J.Rajeeva Lochana

Well-Known Member
May 27, 2019
125
39
28
India
cPanel Access Level
Root Administrator
Twitter
Trying to answer my own question (LOL) this is the best technique I've come up with.

Delete all the error_logs

find /home -type f -name error_log -delete

Then check to see what error_logs are being written too and then go examine the content

find /home -type f -name error_log
Nice Idea! But, be careful not to delete conf files (I know this is not related).

I'm curious if there is a WHM setting to limit the account PHP error_log sizes to prevent things from potentially getting out of hand (especially during a PHP version upgrade) or are we left to manage these manually?
I am not sure, wait until cPanel answers your question.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,257
313
Houston

jazee

Well-Known Member
Jan 12, 2015
119
4
68
cPanel Access Level
Root Administrator
Yes, that's a good feature to use, however right after a system-wide change such as switching to a newer PHP version, it would be more difficult to detect which accounts are generating errors after the change if the error logs are present but only because of past old errors that occurred before the update that were already resolved. If you delete them, then you know which accounts are having issues after the upgrade just by the presence of the error log and you know all the errors in the log occurred after the update.
 
Oct 16, 2019
6
0
1
France
cPanel Access Level
Website Owner
Hello !! :)
Take a look at the log_errors configuration option in php.ini. It seems to do just what you want to. I think you can use the error_log option to set your own logging file too.
When the log_errors directive is set to On, any errors reported by PHP would be logged to the server log or the file specified with error_log. You can set these options with ini_set too, if you need to.
(Please note that display_errors should be disabled in php.ini if this option is enabled)
 
Oct 16, 2019
6
0
1
France
cPanel Access Level
Website Owner
Hello !! :)
Take a look at the log_errors configuration option in php.ini. It seems to do just what you want to. I think you can use the error_log option to set your own logging file too.
When the log_errors directive is set to On, any errors reported by PHP would be logged to the server log or the file specified with error_log. You can set these options with ini_set too, if you need to.
(Please note that display_errors should be disabled in php.ini if this option is enabled)
Any errors reported by PHP would be logged to the server log or the file specified with error_log. You can set these options with ini_set too, if you need to.
DafontShowboxAdam4adam