|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #68570 Add support for specifying command-line options in /etc/sysconfig/php-fpm
Submitted: 2014-12-09 04:34 UTC Modified: 2014-12-11 10:57 UTC
From: guy dot paddock at redbottledesign dot com Assigned: remi (profile)
Status: Not a bug Package: FPM related
PHP Version: 5.4.35 OS: Redhat-based
Private report: No CVE-ID: None
 [2014-12-09 04:34 UTC] guy dot paddock at redbottledesign dot com
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.


php-5.4-fpm-add_PHP_FPM_OPTS_to_sysconfig (last revision 2014-12-09 04:35 UTC by guy dot paddock at redbottledesign dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-09 04:37 UTC] guy dot paddock at redbottledesign dot com
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.
 [2014-12-11 10:57 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: remi
 [2014-12-11 10:57 UTC]
The /etc/sysconfig/php-fpm is distro specific (Red Hat).

So please file a bug to your package provider.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 14 11:05:44 2022 UTC