Commit 28f39d67 authored by Thom Pol's avatar Thom Pol

Only run update-alternatives for php-fpm.sock when multiple PHP version are installed (#30)

parent e191f672
......@@ -57,7 +57,12 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS {
}
if(ISPConfig::shallInstall('web')) {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.3 ; update-alternatives --set php-fpm.sock /run/php/php7.3-fpm.sock';
// When --use-php-system is used, there is no alternative for php-fpm.sock.
if(ISPConfig::wantsPHP() === 'system') {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.3';
} else {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.3 ; update-alternatives --set php-fpm.sock /run/php/php7.3-fpm.sock';
}
$result = $this->exec($cmd);
if($result === false) {
throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
......
......@@ -182,7 +182,12 @@ class ISPConfigDebianOS extends ISPConfigBaseOS {
}
if(ISPConfig::shallInstall('web')) {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.0 ; update-alternatives --set php-fpm.sock /run/php/php7.0-fpm.sock';
// When --use-php-system is used, there is no alternative for php-fpm.sock.
if(ISPConfig::wantsPHP() === 'system') {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.0';
} else {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.0 ; update-alternatives --set php-fpm.sock /run/php/php7.0-fpm.sock';
}
$result = $this->exec($cmd);
if($result === false) {
throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
......
......@@ -107,7 +107,12 @@ maxretry = 3';
}
if(ISPConfig::shallInstall('web')) {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.4 ; update-alternatives --set php-fpm.sock /run/php/php7.4-fpm.sock';
// When --use-php-system is used, there is no alternative for php-fpm.sock.
if(ISPConfig::wantsPHP() === 'system') {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.4';
} else {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.4 ; update-alternatives --set php-fpm.sock /run/php/php7.4-fpm.sock';
}
$result = $this->exec($cmd);
if($result === false) {
throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
......
......@@ -90,7 +90,12 @@ maxretry = 3';
}
if(ISPConfig::shallInstall('web')) {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.2 ; update-alternatives --set php-fpm.sock /run/php/php7.2-fpm.sock';
// When --use-php-system is used, there is no alternative for php-fpm.sock.
if(ISPConfig::wantsPHP() === 'system') {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.2';
} else {
$cmd = 'update-alternatives --set php-cgi /usr/bin/php-cgi7.2 ; update-alternatives --set php-fpm.sock /run/php/php7.2-fpm.sock';
}
$result = $this->exec($cmd);
if($result === false) {
throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment