How to generate error log for failing php script

NetCaptive

Member
Dec 16, 2011
11
0
51
cPanel Access Level
Root Administrator
Hello,

I have a problematic php script i'm trying to work on, but no error log is being generated. Some research shows that maybe it's related to suphp. I've tried making some changes to /usr/lib/php.ini and they don't seem to take (or logs aren't being written).

The script actually broke after i upgraded php to 5.3.28 a few days ago.

Here's some info on versions:
Code:
[~]# php --version                       
PHP 5.3.28 (cli) (built: Apr 16 2014 01:53:31) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd., and
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
Code:
[~]# /usr/local/cpanel/bin/rebuild_phpconf --current
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled
RUID2: not installed
Any assistance would be appreciated.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello :)

What changes did you make to the /usr/local/lib/php.ini file? Make sure the "log_errors" value is "ON". Also, check to see if there is a php.ini file within the account's home directory that is taking precedence.

Thank you.
 

NetCaptive

Member
Dec 16, 2011
11
0
51
cPanel Access Level
Root Administrator
What changes did you make to the /usr/local/lib/php.ini file? Make sure the "log_errors" value is "ON". Also, check to see if there is a php.ini file within the account's home directory that is taking precedence.
I had changed "log_errors = Off" to "log_errors = On" (for /usr/local/lib/php.ini) and it didn't seem to have any effect.

Do i need to restart apache after each change?

There's no php.ini in the account's home folder. I guess i'd rather do that, than turn on logging for everything. What's the best way to implement it, just a single line with "log_errors = On"?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Yes, restart Apache after making that change to the global php.ini file. You should copy the entire /usr/local/lib/php.ini file to the account's home directory rather than just creating the file with the single line.

Thank you.
 

NetCaptive

Member
Dec 16, 2011
11
0
51
cPanel Access Level
Root Administrator
Okay, i copied /usr/local/lib/php.ini to /home/<acct>/php.ini. I edited the php.ini file with these changes (comments removed):
Code:
error_reporting = E_ALL
log_errors = On
error_log = error_log
That didn't work. So i tried adding the full path to the log:

Code:
error_reporting = E_ALL
log_errors = On
error_log = /home/<acct>/error_log
Still no :( So i created the file error_log and chowned it to the account. Still nothing. To generate errors i'm using a sample found here: PHP: trigger_error - Manual

Any tips on what i've done wrong?

- - - Updated - - -

Worth mentioning -- Using the php.net error trigger, i do get an error in my browser.