php-fpm reload workaround targeted at Ubuntu 14.04 breaks newer/fixed PHP packages on Ubuntu 14.04
On lines 250-252 of /server/mods-available/web_module.inc.php
, there appears a bit of conditional logic that was added to address Ubuntu 14.04's broken PHP packages (see: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1242376 ):
if(preg_match('/^ID=ubuntu/m', $tmp) && preg_match('/^VERSION_ID="14\.04"/m', $tmp) {
$initcommand = '/sbin/start-stop-daemon --stop --signal USR2 --quiet --pidfile /var/run/php5-fpm.pid --name php5-fpm';
}
Due to this bug (and others), many administrators have taken to using Ondřej Surý's PHP packages for Ubuntu (see: https://launchpad.net/~ondrej/+archive/ubuntu/php ), which have been patched against the underlying problem.
Accordingly, when using a "fixed" PHP implementation, the above conditional logic fails to have the intended effect. Instead, it breaks ISPConfig's ability to reload the various PHP daemons involved, which causes countless problems when modifying a website, changing its PHP version, etc.
I described the problem exhaustively in a thread at https://www.howtoforge.com/community/threads/configuring-ispconfig-to-work-with-ondrejs-co-installable-php-5-6-and-7-0-package-on-ubuntu.72242/ .
I propose a very simple fix, which is to add one more logical comparison to that first line:
if(preg_match('/^ID=ubuntu/m', $tmp) && preg_match('/^VERSION_ID="14\.04"/m', $tmp) && stristr(phpversion(), 'deb.sury.org') === false) {
This will exclude Ondřej Surý's PHP packages from this otherwise necessary workaround.
If anyone has a more robust way to implement this, I'm very interested. Otherwise, I think we should implement this change as soon as possible.