The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to generate error log for failing php script

Discussion in 'EasyApache' started by NetCaptive, Apr 25, 2014.

  1. NetCaptive

    NetCaptive Member

    Joined:
    Dec 16, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,787
    Likes Received:
    665
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  3. NetCaptive

    NetCaptive Member

    Joined:
    Dec 16, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    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"?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,787
    Likes Received:
    665
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  5. NetCaptive

    NetCaptive Member

    Joined:
    Dec 16, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,787
    Likes Received:
    665
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page