Is there a more eloquent way to set php-fpm to use a different php.ini file?
You can specify an alternative php.ini for php-fpm using the -c command line option. But the init script for php-fpm - /etc/init.d/ea-phpXX-php-fpm doesn't appear to provide an eloquent way of doing this. Unless I'm missing something.
The ea-phpXX-php-fpm init script has the line (using PHP 5.6 as an example, I haven't checked but I assume this applies to all versions of PHP):
Now, I can edit the init script to use the -c option and parameters that I want:
But I'm worried that this change would be overwritten on subsequent PHP updates.
A better solution might be for cPanel to modify the init scripts, to include something like:
before start() in the ea-phpXX-php-fpm init script. Then changing the start line to:
Then users can modify the /opt/cpanel/ea-php56/root/etc/sysconfig/php-fpm file to include:
Or whatever extra parameters they want to include to php-fpm.
Or does the /opt/cpanel/ea-php56/root/etc/sysconfig/php-fpm file risk being overwritten in future PHP updates? Perhaps the init script needs to include another file (i.e. /opt/cpanel/ea-php56/root/etc/sysconfig/php-fpm-extra) that does not get overwritten by updates to ea-php56-php-fpm-5.6.XX yum packages).
Or is there already a way to do this that I'm just not aware of.
Why not just make the changes I need made to the /opt/cpanel/ea-php56/root/etc/php.ini file?
Well, I recently spent more time than I care to admit troubleshooting an issue where disable_functions cannot be modified with php_admin_value directives in individual FPM pools (you can add to the directive, but you can't remove functions that exist in the php.ini file). Since EA4's PHP is tied to /opt/cpanel/ea-php56/root/etc/php.ini, I would prefer to lock down /opt/cpanel/ea-php56/root/etc/php.ini as much as possible (i.e. a default case, in case something doesn't get tied to my customized php.ini file it will default to this highly locked down php.ini). By specifying an alternative php.ini in php-fpm's startup, I can disable disable_functions in the php.ini file and set disable_functions per pool using php_admin_values for each pool.
And just to be clear, I'm not talking about per pool php.ini files. I don't believe this is possible. I seem to recall seeing some discussion about this. I'm just talking about the master php-fpm process, the php.ini file that it uses and passes on to the pools.
You can specify an alternative php.ini for php-fpm using the -c command line option. But the init script for php-fpm - /etc/init.d/ea-phpXX-php-fpm doesn't appear to provide an eloquent way of doing this. Unless I'm missing something.
The ea-phpXX-php-fpm init script has the line (using PHP 5.6 as an example, I haven't checked but I assume this applies to all versions of PHP):
Code:
daemon --pidfile ${pidfile} /opt/cpanel/ea-php56/root/usr/sbin/php-fpm --daemonize
Code:
daemon --pidfile ${pidfile} /opt/cpanel/ea-php56/root/usr/sbin/php-fpm -c /opt/my/custom/php/ini --daemonize
A better solution might be for cPanel to modify the init scripts, to include something like:
Code:
if [ -z "${EXTRAPARAMETERS}" ]
then
EXTRAPARAMETERS=""
fi
Code:
daemon --pidfile ${pidfile} /opt/cpanel/ea-php56/root/usr/sbin/php-fpm ${EXTRAPARAMETERS} --daemonize
Code:
EXTRAPARAMETERS=" -c /opt/my/custom/php/ini"
Or does the /opt/cpanel/ea-php56/root/etc/sysconfig/php-fpm file risk being overwritten in future PHP updates? Perhaps the init script needs to include another file (i.e. /opt/cpanel/ea-php56/root/etc/sysconfig/php-fpm-extra) that does not get overwritten by updates to ea-php56-php-fpm-5.6.XX yum packages).
Or is there already a way to do this that I'm just not aware of.
Why not just make the changes I need made to the /opt/cpanel/ea-php56/root/etc/php.ini file?
Well, I recently spent more time than I care to admit troubleshooting an issue where disable_functions cannot be modified with php_admin_value directives in individual FPM pools (you can add to the directive, but you can't remove functions that exist in the php.ini file). Since EA4's PHP is tied to /opt/cpanel/ea-php56/root/etc/php.ini, I would prefer to lock down /opt/cpanel/ea-php56/root/etc/php.ini as much as possible (i.e. a default case, in case something doesn't get tied to my customized php.ini file it will default to this highly locked down php.ini). By specifying an alternative php.ini in php-fpm's startup, I can disable disable_functions in the php.ini file and set disable_functions per pool using php_admin_values for each pool.
And just to be clear, I'm not talking about per pool php.ini files. I don't believe this is possible. I seem to recall seeing some discussion about this. I'm just talking about the master php-fpm process, the php.ini file that it uses and passes on to the pools.