php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69662 PHP Startup errors are erroneously logged as master user in pool error log
Submitted: 2015-05-19 15:48 UTC Modified: -
From: reallfqq-php at yahoo dot fr Assigned:
Status: Open Package: FPM related
PHP Version: 5.4.41 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: reallfqq-php at yahoo dot fr
New email:
PHP Version: OS:

 

 [2015-05-19 15:48 UTC] reallfqq-php at yahoo dot fr
Description:
------------
When dealing with startup errors in PHP-FPM, messages as the following are generated:
PHP Warning:  PHP Startup: Unable to load dynamic library '***' - ***: cannot open shared object file: No such file or directory in Unknown on line 0

The problem is, those end up in the file configured in the pool's error_log directive (either in php.ini or through php_[admin_]value in a pool in php-fpm.conf), not in the one configured through FPM's php-fpm.conf error_log directive.

Since it is startup errors, the log entries are generated by the master process (which is usually root:root), thus generating the pool's error log with root:root rights, while the workers are fired up with user:group (configured in the pool).

You end up in a situation where workers are unable to log error messages in their pool's defined error log (since user:group is unable to write in a log generated with root:root file with standard 644 mask).

Any error generated at master level shall be logged in the master log file (configured through the FPM's error_log directive).
Or you should ensure that everything ending up in the pool's error log is written with the pool's configured user:group permissions.

Test script:
---------------
1°) Configure a non-existent module in FPM's php.ini:
extension = nonexistent.so

2°) Clear any existing log file corresponding to the FPM's php.ini error_log directive or configured through FPM's php-fpm.conf php_[admin_]value.

3°) Restart PHP-FPM

4°) Pool's error log is created with root:root rights (644 mask) instead of either:
a) using the FPM's error log file (configured through FPM's php-fpm.conf error_log)
b) generating the error in pool's log file (configured through FPM's php.ini error_log or through php_[admin_]value) with the pool's defined user:group permissions


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri May 29 10:01:26 2020 UTC