Req #68570 [Com]: Add support for specifying command-line options in /etc/sysconfig/php-fpm
| From: | guy dot paddock at redbottledesign dot com | Date: | Tue, 09 Dec 2014 04:37:12 +0000 |
| Subject: | Req #68570 [Com]: Add support for specifying command-line options in /etc/sysconfig/php-fpm | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188968@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68570&edit=1
ID: 68570
Comment by: guy dot paddock at redbottledesign dot com
Reported by: guy dot paddock at redbottledesign dot com
Summary: Add support for specifying command-line options in
/etc/sysconfig/php-fpm
Status: Open
Type: Feature/Change Request
Package: FPM related
Operating System: Redhat-based
PHP Version: 5.4.35
Block user comment: N
Private report: N
New Comment:
I forgot to mention that in my example, that assumes New Relic is installed. It's immaterial to
the patch, but I felt I should mention it for anyone just following along wondering where that PHP
setting matters.
Previous Comments:
------------------------------------------------------------------------
[2014-12-09 04:34:38] guy dot paddock at redbottledesign dot com
Description:
------------
Currently, the "/etc/init.d/php-fpm" init script loads additional environment variables
from "/etc/sysconfig/php-fpm", as is a standard pattern for a RedHat init scripts.
Unfortunately, there's currently nothing useful that one can put in that file because there are
no variables that the init script currently expects to be defined in
"/etc/sysconfig/php-fpm".
This is a missed opportunity. I propose that this line in the "start()" portion of the
init script:
daemon --pidfile ${pidfile} php-fpm --daemonize
Be changed to this:
daemon --pidfile ${pidfile} php-fpm --daemonize ${PHP_FPM_OPTS}
To enable /etc/sysconfig/php-fpm to contain additional command-line options (such as PHP option
definitions, etc) to be supplied.
With this simple change, we can then provide options in /etc/sysconfig/php-fpm like so:
PHP_FPM_OPTS="-d newrelic.appname='PHP-FPM Application Environment'"
In the example above, we use this to force the name of the application reported for any PHP scripts
running through FPM to be flagged as such. This is only one such example, but anything is possible.
If you're wondering why one cannot simply just specify settings in the system-wide php.ini or
in the global config, it's because on shared hosting systems (especially those managed by a
panel like Plesk or cPanel), the global php.ini is shared between FPM and FastCGI or Apache PHP; the
global config does not support PHP settings; and the FPM pool configs are often auto-generated and
not modifiable.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68570&edit=1