diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php
index 2672965254c0d47865255f4c894220e5a8235c34..8c7b738b2ed7a44fd64e7a8342352d74d478b8a0 100644
--- a/interface/web/sites/ajax_get_json.php
+++ b/interface/web/sites/ajax_get_json.php
@@ -38,6 +38,7 @@ $app->uses('getconf');
$server_id = intval($_GET["server_id"]);
$web_id = intval($_GET["web_id"]);
+$php_type = $_GET["php_type"];
$type = $_GET["type"];
//if($_SESSION["s"]["user"]["typ"] == 'admin') {
@@ -67,16 +68,17 @@ $type = $_GET["type"];
$server_type = 'apache';
$web_config = $app->getconf->get_server_config($server_id, 'web');
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
- if($server_type == 'nginx'){
- $sql = "SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id";
- } else {
- $sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id";
+ if($server_type == 'nginx' && $php_type == 'fast-cgi') $php_type = 'php-fpm';
+ if($php_type == 'php-fpm'){
+ $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 = $server_id");
+ }
+ if($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 = $server_id");
}
- $php_records = $app->db->queryAllRecords($sql);
$php_select = "";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
- if($server_type == 'nginx'){
+ if($php_type == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
diff --git a/interface/web/sites/lib/lang/de_web_domain.lng b/interface/web/sites/lib/lang/de_web_domain.lng
index a15b5d48d920c5d10290ce05ee6632f7cbe342d5..a1e9975c405d041d012bf1a96a24fba67e62fc9e 100644
--- a/interface/web/sites/lib/lang/de_web_domain.lng
+++ b/interface/web/sites/lib/lang/de_web_domain.lng
@@ -91,5 +91,5 @@ $wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers muß
$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers muß eine positive ganze Zahl sein.';
$wb['hd_quota_error_regex'] = 'Harddisk Quota ist ungültig.';
$wb['traffic_quota_error_regex'] = 'Traffic Quota ist ungültig.';
-$wb["fastcgi_php_version_txt"] = 'FastCGI-PHP-Version';
+$wb["fastcgi_php_version_txt"] = 'PHP-Version';
?>
diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng
index c02c4b60ac17575cb7236b423f88202b90a5e663..0b4f7fc5fe6ab867d6b2754aee0e44e96e5f568d 100644
--- a/interface/web/sites/lib/lang/en_web_domain.lng
+++ b/interface/web/sites/lib/lang/en_web_domain.lng
@@ -91,5 +91,5 @@ $wb["pm_min_spare_servers_error_regex"] = 'PHP-FPM pm.min_spare_servers must be
$wb["pm_max_spare_servers_error_regex"] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
$wb["hd_quota_error_regex"] = 'Harddisk quota is invalid.';
$wb["traffic_quota_error_regex"] = 'Traffic quota is invalid.';
-$wb["fastcgi_php_version_txt"] = 'FastCGI PHP Version';
+$wb["fastcgi_php_version_txt"] = 'PHP Version';
?>
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_domain_edit.htm b/interface/web/sites/templates/web_domain_edit.htm
index 25eaa9414b7c715421025a9a73660a86423e563d..80a1b1c4ae6e432359a4425ca55cdd61e7f4ac4a 100644
--- a/interface/web/sites/templates/web_domain_edit.htm
+++ b/interface/web/sites/templates/web_domain_edit.htm
@@ -167,13 +167,14 @@
reloadWebIP();
});
- if(jQuery('#php').val() == 'fast-cgi'){
+ if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm'){
jQuery('.fastcgi_php_version:hidden').show();
} else {
jQuery('.fastcgi_php_version:visible').hide();
}
jQuery('#php').change(function(){
- if(jQuery(this).val() == 'fast-cgi'){
+ reloadFastcgiPHPVersions();
+ if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm'){
jQuery('.fastcgi_php_version:hidden').show();
} else {
jQuery('.fastcgi_php_version:visible').hide();
@@ -206,7 +207,7 @@
}
function reloadFastcgiPHPVersions() {
- jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getphpfastcgi"}, function(data) {
+ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi"}, function(data) {
var options = '';
var phpfastcgiselected = '';
$.each(data, function(key, val) {
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index f8dcb973314e860feffd31ac6cbbd0e6d0bc490c..731fb5c9e38be8c89a06cdfe091ed27be728ddb1 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -135,16 +135,17 @@ class page_action extends tform_actions {
$server_type = 'apache';
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
- if($server_type == 'nginx'){
- $sql = "SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
- } else {
- $sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
+ if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $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 = ".$client['default_webserver']." AND (client_id = 0 OR client_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 = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
}
- $php_records = $app->db->queryAllRecords($sql);
$php_select = "";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
- if($server_type == 'nginx'){
+ if($this->dataRecord['php'] == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
@@ -216,16 +217,17 @@ class page_action extends tform_actions {
$server_type = 'apache';
$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
- if($server_type == 'nginx'){
- $sql = "SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
- } else {
- $sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
+ if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $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 = ".$client['default_webserver']." AND (client_id = 0 OR client_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 = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")");
}
- $php_records = $app->db->queryAllRecords($sql);
$php_select = "";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
- if($server_type == 'nginx'){
+ if($this->dataRecord['php'] == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
@@ -288,16 +290,17 @@ class page_action extends tform_actions {
$server_type = 'apache';
$web_config = $app->getconf->get_server_config($server_id, 'web');
if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
- if($server_type == 'nginx'){
- $sql = "SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id";
- } else {
- $sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id";
+ if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
+ if($this->dataRecord['php'] == 'php-fpm'){
+ $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 = $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 = $server_id");
}
- $php_records = $app->db->queryAllRecords($sql);
$php_select = "";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
- if($server_type == 'nginx'){
+ if($this->dataRecord['php'] == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index e048b5fbdd1e02fc22c802abe12ac5ffbbdc7712..4315dfa45d0f1b655c890c9f241eefe8117cff84 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -960,18 +960,38 @@ class apache2_plugin {
$tpl->setVar('fastcgi_starter_script',$fastcgi_config['fastcgi_starter_script']);
$tpl->setVar('fastcgi_config_syntax',$fastcgi_config['fastcgi_config_syntax']);
+ } else {
+ //remove the php fastgi starter script if available
+ if ($data['old']['php'] == 'fast-cgi') {
+ $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
+ $fastcgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$fastcgi_config['fastcgi_starter_path']);
+ $fastcgi_starter_path = str_replace('[client_id]',$client_id,$fastcgi_starter_path);
+ if (is_dir($fastcgi_starter_path)) {
+ exec('rm -rf '.$fastcgi_starter_path);
+ }
+ }
}
/**
* PHP-FPM
*/
// Support for multiple PHP versions
- if(trim($data['new']['fastcgi_php_version']) != ''){
- $default_php_fpm = false;
- list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
- if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ if($data['new']['php'] == 'php-fpm'){
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
} else {
- $default_php_fpm = true;
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
}
if($default_php_fpm){
@@ -1926,12 +1946,22 @@ class apache2_plugin {
global $app, $conf;
//$reload = false;
- if(trim($data['new']['fastcgi_php_version']) != ''){
- $default_php_fpm = false;
- list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
- if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ if($data['new']['php'] == 'php-fpm'){
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
} else {
- $default_php_fpm = true;
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
}
$app->uses("getconf");
@@ -2070,7 +2100,7 @@ class apache2_plugin {
private function php_fpm_pool_delete ($data,$web_config) {
global $app, $conf;
- if(trim($data['old']['fastcgi_php_version']) != ''){
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
$default_php_fpm = false;
list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';