Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Changing PHP-FPM error_log location

Discussion in 'EasyApache' started by rappie, Feb 5, 2018.

  1. rappie

    rappie Member

    Oct 4, 2008
    Likes Received:
    Trophy Points:
    I switched to using PHP-FPM as the default PHP handler for my servers. Works great!

    However, previously when using the default CGI handler, PHP error logs resided in the same directory as the PHP file that created the error. This was a very useful setup to me. With PHP-FPM the default error log location is at: /home/username/logs/domain_tld.php.error.log

    I'd like to change this so that error logs are created again in the same directory as the PHP file that caused the error.

    This seems a bit harder to achieve than I anticipated. I thought all I had to do is change the PHP-FPM configuration so that error log location is set to simply a the file name, without any slashes.

    I've added the following line blow to /var/cpanel/userdata/user/domain.php_fpm.yaml file and ran /usr/local/cpanel/scripts/php_fpm_config --rebuild.

    php_admin_value_error_log: { name: 'php_admin_value[error_log]', value: "error_log" }

    This successfully changed the error log value in the PHP configuration to error_log. Unfortunately however still no error_log file is created in the same directory as the PHP file that caused the error. Also errors aren't logged to the /home/username/logs/domain_tld.php.error.log location.

    So ... what am I missing? How do get a error log files created in the same directory as the PHP file that caused the error?
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    As I understand, you'd need to define a specific path. EX:

    # cat /var/cpanel/userdata/username/
    _is_present: 1
    php_admin_value_error_log: { name: 'php_admin_value[error_log]', value: /home/username/public_html/error_log }
    As far as logging to individual error_log files in specific directories, you could try customizing a path with variables such as "[% documentroot %]" that we document at:

    Configurations Values of PHP-FPM - Version 68 Documentation - cPanel Documentation

    Thank you.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice