From a6df2bbc499e951cd897e16da4a166234890a6e7 Mon Sep 17 00:00:00 2001
From: florian030 <florian@schaal-24.de>
Date: Thu, 3 May 2018 14:28:16 +0200
Subject: [PATCH] add option to set additional php-versions active/inactive

---
 .../sql/incremental/upd_dev_collection.sql    |  1 +
 install/sql/ispconfig3.sql                    |  1 +
 interface/web/admin/form/server_php.tform.php |  7 ++++++
 .../web/admin/lib/lang/ar_server_php.lng      |  1 +
 .../web/admin/lib/lang/bg_server_php.lng      |  1 +
 .../web/admin/lib/lang/br_server_php.lng      |  1 +
 .../web/admin/lib/lang/ca_server_php.lng      |  1 +
 .../web/admin/lib/lang/cz_server_php.lng      |  1 +
 .../web/admin/lib/lang/de_server_php.lng      |  1 +
 .../web/admin/lib/lang/dk_server_php.lng      |  1 +
 .../web/admin/lib/lang/el_server_php.lng      |  1 +
 .../web/admin/lib/lang/en_server_php.lng      |  1 +
 .../web/admin/lib/lang/es_server_php.lng      |  1 +
 .../web/admin/lib/lang/fi_server_php.lng      |  1 +
 .../web/admin/lib/lang/fr_server_php.lng      |  1 +
 .../web/admin/lib/lang/hr_server_php.lng      |  1 +
 .../web/admin/lib/lang/hu_server_php.lng      |  1 +
 .../web/admin/lib/lang/id_server_php.lng      |  1 +
 .../web/admin/lib/lang/it_server_php.lng      |  1 +
 .../web/admin/lib/lang/ja_server_php.lng      |  1 +
 .../web/admin/lib/lang/nl_server_php.lng      |  1 +
 .../web/admin/lib/lang/pl_server_php.lng      |  1 +
 .../web/admin/lib/lang/pt_server_php.lng      |  1 +
 .../web/admin/lib/lang/ro_server_php.lng      |  1 +
 .../web/admin/lib/lang/ru_server_php.lng      |  1 +
 .../web/admin/lib/lang/se_server_php.lng      |  1 +
 .../web/admin/lib/lang/sk_server_php.lng      |  1 +
 .../web/admin/lib/lang/tr_server_php.lng      |  1 +
 .../admin/templates/server_php_name_edit.htm  |  6 +++--
 interface/web/sites/ajax_get_json.php         |  4 ++--
 interface/web/sites/web_vhost_domain_edit.php | 24 +++++++++----------
 31 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql
index f73a20b057..3129b68a75 100644
--- a/install/sql/incremental/upd_dev_collection.sql
+++ b/install/sql/incremental/upd_dev_collection.sql
@@ -1,3 +1,4 @@
 ALTER TABLE `web_domain` ADD COLUMN `ssl_letsencrypt_exclude` enum('n','y') NOT NULL DEFAULT 'n' AFTER `ssl_letsencrypt`;
 ALTER TABLE `remote_user` ADD `remote_access` ENUM('y','n') NOT NULL DEFAULT 'y' AFTER `remote_password`;
 ALTER TABLE `remote_user` ADD `remote_ips` TEXT AFTER `remote_access`;
+ALTER TABLE `server_php` ADD `active` enum('y','n') NOT NULL DEFAULT 'y' AFTER `php_fpm_pool_dir`;
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 9aa91701bc..df1e7f3b44 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -1346,6 +1346,7 @@ CREATE TABLE `server_php` (
   `php_fpm_init_script` varchar(255) DEFAULT NULL,
   `php_fpm_ini_dir` varchar(255) DEFAULT NULL,
   `php_fpm_pool_dir` varchar(255) DEFAULT NULL,
+  `active` enum('n','y') NOT NULL DEFAULT 'y',
   PRIMARY KEY (`server_php_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
diff --git a/interface/web/admin/form/server_php.tform.php b/interface/web/admin/form/server_php.tform.php
index c94bb38c01..67e54ec6b5 100644
--- a/interface/web/admin/form/server_php.tform.php
+++ b/interface/web/admin/form/server_php.tform.php
@@ -124,6 +124,13 @@ $form["tabs"]['php_name'] = array (
 			'width'  => '40',
 			'maxlength' => '255'
 		),
+		'active' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
+		),
+
 		//#################################
 		// ENDE Datenbankfelder
 		//#################################
diff --git a/interface/web/admin/lib/lang/ar_server_php.lng b/interface/web/admin/lib/lang/ar_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/ar_server_php.lng
+++ b/interface/web/admin/lib/lang/ar_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/bg_server_php.lng b/interface/web/admin/lib/lang/bg_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/bg_server_php.lng
+++ b/interface/web/admin/lib/lang/bg_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/br_server_php.lng b/interface/web/admin/lib/lang/br_server_php.lng
index 21e199652d..459b4d9e0c 100644
--- a/interface/web/admin/lib/lang/br_server_php.lng
+++ b/interface/web/admin/lib/lang/br_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Caminho do diretório do php.ini';
 $wb['php_fpm_init_script_txt'] = 'Caminho do script de inicialização do PHP-FPM';
 $wb['php_fpm_ini_dir_txt'] = 'Caminho do diretório do php.ini';
 $wb['php_fpm_pool_dir_txt'] = 'Caminho do diretório de faixas (pool) do PHP-FPM';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/ca_server_php.lng b/interface/web/admin/lib/lang/ca_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/ca_server_php.lng
+++ b/interface/web/admin/lib/lang/ca_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/cz_server_php.lng b/interface/web/admin/lib/lang/cz_server_php.lng
index 10aba05dd7..615431c355 100644
--- a/interface/web/admin/lib/lang/cz_server_php.lng
+++ b/interface/web/admin/lib/lang/cz_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Cesta k php.ini adresáři';
 $wb['php_fpm_init_script_txt'] = 'Cesta k PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Cesta k php.ini adresáři';
 $wb['php_fpm_pool_dir_txt'] = 'Cesta k PHP-FPM pool adresáři';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/de_server_php.lng b/interface/web/admin/lib/lang/de_server_php.lng
index 9b26ea3c6d..67dad7064a 100644
--- a/interface/web/admin/lib/lang/de_server_php.lng
+++ b/interface/web/admin/lib/lang/de_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Pfad zum php.ini Verzeichnis';
 $wb['php_fpm_init_script_txt'] = 'Pfad zum PHP-FPM Init Script';
 $wb['php_fpm_ini_dir_txt'] = 'Pfad zum php.ini Verzeichnis';
 $wb['php_fpm_pool_dir_txt'] = 'Pfad zum PHP-FPM Pool Verzeichnis';
+$wb['active_txt'] = 'Aktiv';
 ?>
diff --git a/interface/web/admin/lib/lang/dk_server_php.lng b/interface/web/admin/lib/lang/dk_server_php.lng
index cc821ec2f2..ff8586f5ea 100644
--- a/interface/web/admin/lib/lang/dk_server_php.lng
+++ b/interface/web/admin/lib/lang/dk_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Sti til php.ini mappe';
 $wb['php_fpm_init_script_txt'] = 'Sti til PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Sti til php.ini mappe';
 $wb['php_fpm_pool_dir_txt'] = 'Sti til PHP-FPM pool mappe';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/el_server_php.lng b/interface/web/admin/lib/lang/el_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/el_server_php.lng
+++ b/interface/web/admin/lib/lang/el_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/en_server_php.lng b/interface/web/admin/lib/lang/en_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/en_server_php.lng
+++ b/interface/web/admin/lib/lang/en_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/es_server_php.lng b/interface/web/admin/lib/lang/es_server_php.lng
index 4d063113bb..762fa0ed8c 100755
--- a/interface/web/admin/lib/lang/es_server_php.lng
+++ b/interface/web/admin/lib/lang/es_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fpm_init_script_txt'] = 'Ruta al archivo de arranque de PHP-FPM';
 $wb['php_fpm_pool_dir_txt'] = 'Ruta al directorio de procesos de PHP-FPM';
 $wb['server_id_txt'] = 'Servidor';
 $wb['server_php_name_error_empty'] = 'El campo Nombre no puede estar vacío.';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/fi_server_php.lng b/interface/web/admin/lib/lang/fi_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/fi_server_php.lng
+++ b/interface/web/admin/lib/lang/fi_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/fr_server_php.lng b/interface/web/admin/lib/lang/fr_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/fr_server_php.lng
+++ b/interface/web/admin/lib/lang/fr_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/hr_server_php.lng b/interface/web/admin/lib/lang/hr_server_php.lng
index 585332f6d0..5bfc1dd6d2 100644
--- a/interface/web/admin/lib/lang/hr_server_php.lng
+++ b/interface/web/admin/lib/lang/hr_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Putanja do php.ini direktorija';
 $wb['php_fpm_init_script_txt'] = 'Putanja do PHP-FPM init skripte';
 $wb['php_fpm_ini_dir_txt'] = 'Putanja do php.ini direktorija';
 $wb['php_fpm_pool_dir_txt'] = 'Putanja do PHP-FPM pool direktorija';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/hu_server_php.lng b/interface/web/admin/lib/lang/hu_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/hu_server_php.lng
+++ b/interface/web/admin/lib/lang/hu_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/id_server_php.lng b/interface/web/admin/lib/lang/id_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/id_server_php.lng
+++ b/interface/web/admin/lib/lang/id_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/it_server_php.lng b/interface/web/admin/lib/lang/it_server_php.lng
index 1b8d4ffc74..805528f376 100644
--- a/interface/web/admin/lib/lang/it_server_php.lng
+++ b/interface/web/admin/lib/lang/it_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Percorso per  php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Percorso per  PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Percorso per  php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Percorso per  PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/ja_server_php.lng b/interface/web/admin/lib/lang/ja_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/ja_server_php.lng
+++ b/interface/web/admin/lib/lang/ja_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/nl_server_php.lng b/interface/web/admin/lib/lang/nl_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/nl_server_php.lng
+++ b/interface/web/admin/lib/lang/nl_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/pl_server_php.lng b/interface/web/admin/lib/lang/pl_server_php.lng
index 298eca6511..5a7c7b6f9b 100644
--- a/interface/web/admin/lib/lang/pl_server_php.lng
+++ b/interface/web/admin/lib/lang/pl_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Ścieżka do katalogu php.ini';
 $wb['php_fpm_init_script_txt'] = 'Ścieżka do skryptu inicjującego PHP-FPM';
 $wb['php_fpm_ini_dir_txt'] = 'Ścieżka do katalogu php.ini';
 $wb['php_fpm_pool_dir_txt'] = 'Ścieżka do katalogu pool PHP-FPM';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/pt_server_php.lng b/interface/web/admin/lib/lang/pt_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/pt_server_php.lng
+++ b/interface/web/admin/lib/lang/pt_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/ro_server_php.lng b/interface/web/admin/lib/lang/ro_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/ro_server_php.lng
+++ b/interface/web/admin/lib/lang/ro_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/ru_server_php.lng b/interface/web/admin/lib/lang/ru_server_php.lng
index 8189eed075..854b8a3c23 100644
--- a/interface/web/admin/lib/lang/ru_server_php.lng
+++ b/interface/web/admin/lib/lang/ru_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Путь к каталогу php.ini FastCGI';
 $wb['php_fpm_init_script_txt'] = 'Путь к скрипту нициализации PHP-FPM';
 $wb['php_fpm_ini_dir_txt'] = 'Путь к каталогу php.ini PHP-FPM';
 $wb['php_fpm_pool_dir_txt'] = 'Путь до каталога пула PHP-FPM';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/se_server_php.lng b/interface/web/admin/lib/lang/se_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/se_server_php.lng
+++ b/interface/web/admin/lib/lang/se_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/sk_server_php.lng b/interface/web/admin/lib/lang/sk_server_php.lng
index addbfa4935..179a8fc357 100644
--- a/interface/web/admin/lib/lang/sk_server_php.lng
+++ b/interface/web/admin/lib/lang/sk_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
 $wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
 $wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/lib/lang/tr_server_php.lng b/interface/web/admin/lib/lang/tr_server_php.lng
index a86d1959b2..8728444f13 100644
--- a/interface/web/admin/lib/lang/tr_server_php.lng
+++ b/interface/web/admin/lib/lang/tr_server_php.lng
@@ -13,4 +13,5 @@ $wb['php_fastcgi_ini_dir_txt'] = 'php.ini Klasörünün Yolu';
 $wb['php_fpm_init_script_txt'] = 'PHP-FPM BaÅŸlatma BetiÄŸinin Yolu';
 $wb['php_fpm_ini_dir_txt'] = 'php.ini Klasörünün Yolu';
 $wb['php_fpm_pool_dir_txt'] = 'PHP-FPM Havuz Klasörünün Yolu';
+$wb['active_txt'] = 'Active';
 ?>
diff --git a/interface/web/admin/templates/server_php_name_edit.htm b/interface/web/admin/templates/server_php_name_edit.htm
index 067aa719a4..cfdaab63f9 100644
--- a/interface/web/admin/templates/server_php_name_edit.htm
+++ b/interface/web/admin/templates/server_php_name_edit.htm
@@ -20,11 +20,13 @@
             <div class="form-group">
                 <label for="name" class="col-sm-3 control-label">{tmpl_var name='name_txt'}</label>
                 <div class="col-sm-9"><input type="text" name="name" id="name" value="{tmpl_var name='name'}" class="form-control" /></div></div>
-        
+			<div class="form-group">
+				<label class="col-sm-3 control-label">{tmpl_var name='active_txt'}</label>
+                <div class="col-sm-9">{tmpl_var name='active'}</div></div>
             
         <input type="hidden" name="id" value="{tmpl_var name='id'}">
             
         <div class="clear"><div class="right">
             <button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="admin/server_php_edit.php">{tmpl_var name='btn_save_txt'}</button>
             <button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="admin/server_php_list.php">{tmpl_var name='btn_cancel_txt'}</button>
-        </div></div>
\ No newline at end of file
+        </div></div>
diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php
index a3e54e8860..d79eba2392 100644
--- a/interface/web/sites/ajax_get_json.php
+++ b/interface/web/sites/ajax_get_json.php
@@ -93,9 +93,9 @@ if($type == 'getphpfastcgi'){
 	}
 
 	if($php_type == 'php-fpm' || ($php_type == 'hhvm' && $server_type == 'nginx')){
-		$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where, $server_id);
+		$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND active = 'y'".$sql_where, $server_id);
 	} elseif($php_type == 'fast-cgi'){
-		$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where, $server_id);
+		$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND active = 'y'".$sql_where, $server_id);
 	}
 	$php_select = "";
 	if(is_array($php_records) && !empty($php_records)) {
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index 3c9fcc1306..80b7f38f44 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -244,17 +244,17 @@ class page_action extends tform_actions {
 
 			if($this->_vhostdomain_type == 'domain') {
 				if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y'", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']);
 				}
 				if($this->dataRecord['php'] == 'fast-cgi'){
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y'", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']);
 				}
 			} else {
 				if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y'", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
 				}
 				if($this->dataRecord['php'] == 'fast-cgi'){
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y'", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
 				}
 			}
 			$php_select = "<option value=''>Default</option>";
@@ -388,7 +388,7 @@ class page_action extends tform_actions {
 			if(!empty($web_config[$server_id]['server_type'])) $server_type = $web_config[$server_id]['server_type'];
 			if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
 			$selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id);
-			$sql_where = " AND (client_id = 0 OR client_id = ?)";
+			$sql_where = " AND (client_id = 0 OR client_id = ?) AND active = 'y'";
 			if($this->_vhostdomain_type == 'domain') {
 				if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
 					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where, ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $selected_client['client_id']);
@@ -398,10 +398,10 @@ class page_action extends tform_actions {
 				}
 			} else {
 				if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y'", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
 				}
 				if($this->dataRecord['php'] == 'fast-cgi') {
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?)", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y'", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
 				}
 			}
 			$php_select = "<option value=''>Default</option>";
@@ -608,7 +608,7 @@ class page_action extends tform_actions {
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
 			if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
 			$selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id);
-			$sql_where = " AND (client_id = 0 OR client_id = ?)";
+			$sql_where = " AND (client_id = 0 OR client_id = ?) AND active = 'y'";
 			if($this->_vhostdomain_type == 'domain') {
 				if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
 					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where, $server_id, $selected_client['client_id']);
@@ -618,10 +618,10 @@ class page_action extends tform_actions {
 				}
 			} else {
 				if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $parent_domain['server_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND active = 'y'", $parent_domain['server_id']);
 				}
 				if($this->dataRecord['php'] == 'fast-cgi') {
-					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?", $parent_domain['server_id']);
+					$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND active = 'y'", $parent_domain['server_id']);
 				}
 			}
 			$php_select = "<option value=''>Default</option>";
@@ -1339,7 +1339,7 @@ class page_action extends tform_actions {
 		if(isset($this->dataRecord['fastcgi_php_version']) && $this->dataRecord['fastcgi_php_version'] != '') {
 			// Check php-fpm mode
 			if($this->dataRecord['php'] == 'php-fpm'){
-				$tmp = $app->db->queryOneRecord("SELECT * FROM server_php WHERE CONCAT(name,':',php_fpm_init_script,':',php_fpm_ini_dir,':',php_fpm_pool_dir) = '".$app->db->quote($this->dataRecord['fastcgi_php_version'])."'");
+				$tmp = $app->db->queryOneRecord("SELECT * FROM server_php WHERE active = 'y' AND CONCAT(name,':',php_fpm_init_script,':',php_fpm_ini_dir,':',php_fpm_pool_dir) = '".$app->db->quote($this->dataRecord['fastcgi_php_version'])."'");
 				if(is_array($tmp)) {
 					$this->dataRecord['fastcgi_php_version'] = $tmp['name'].':'.$tmp['php_fpm_init_script'].':'.$tmp['php_fpm_ini_dir'].':'.$tmp['php_fpm_pool_dir'];
 				} else {
@@ -1348,7 +1348,7 @@ class page_action extends tform_actions {
 				unset($tmp);
 			// Check fast-cgi mode
 			} elseif($this->dataRecord['php'] == 'fast-cgi') {
-				$tmp = $app->db->queryOneRecord("SELECT * FROM server_php WHERE CONCAT(name,':',php_fastcgi_binary,':',php_fastcgi_ini_dir) = '".$app->db->quote($this->dataRecord['fastcgi_php_version'])."'");
+				$tmp = $app->db->queryOneRecord("SELECT * FROM server_php WHERE active = 'y' AND CONCAT(name,':',php_fastcgi_binary,':',php_fastcgi_ini_dir) = '".$app->db->quote($this->dataRecord['fastcgi_php_version'])."'");
 				if(is_array($tmp)) {
 					$this->dataRecord['fastcgi_php_version'] = $tmp['name'].':'.$tmp['php_fastcgi_binary'].':'.$tmp['php_fastcgi_ini_dir'];
 				} else {
-- 
GitLab