diff --git a/install/sql/incremental/upd_0032.sql b/install/sql/incremental/upd_0032.sql new file mode 100644 index 0000000000000000000000000000000000000000..02e2178174ede90ab52f8555ae084c8c083b1856 --- /dev/null +++ b/install/sql/incremental/upd_0032.sql @@ -0,0 +1,2 @@ +ALTER TABLE `web_domain` ADD `pm` ENUM( 'static', 'dynamic', 'ondemand' ) NOT NULL DEFAULT 'dynamic' AFTER `php_fpm_use_socket`; +ALTER TABLE `web_domain` ADD `pm_process_idle_timeout` INT NOT NULL DEFAULT '10' AFTER `pm_max_spare_servers` , ADD `pm_max_requests` INT NOT NULL DEFAULT '0' AFTER `pm_process_idle_timeout`; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 779cbf70e74ba4ef0273046d0efb013d5a8fb760..fe97e9ca3d9a83ab84d486b3e31b2f96d422575c 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1564,10 +1564,13 @@ CREATE TABLE `web_domain` ( `apache_directives` mediumtext, `nginx_directives` mediumtext, `php_fpm_use_socket` ENUM('n','y') NOT NULL DEFAULT 'n', + `pm` enum('static','dynamic','ondemand') NOT NULL DEFAULT 'dynamic', `pm_max_children` int(11) NOT NULL DEFAULT '10', `pm_start_servers` int(11) NOT NULL DEFAULT '2', `pm_min_spare_servers` int(11) NOT NULL DEFAULT '1', `pm_max_spare_servers` int(11) NOT NULL DEFAULT '5', + `pm_process_idle_timeout` int(11) NOT NULL DEFAULT '10', + `pm_max_requests` int(11) NOT NULL DEFAULT '0', `php_open_basedir` mediumtext, `custom_php_ini` mediumtext, `backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none', diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php index 3b27287ab65f141c90955385903be8db4498e29f..ce835a94b353ea269ba87b424d0625f376c11f59 100644 --- a/interface/web/sites/form/web_domain.tform.php +++ b/interface/web/sites/form/web_domain.tform.php @@ -542,6 +542,12 @@ $form["tabs"]['advanced'] = array ( 'default' => 'n', 'value' => array(0 => 'n',1 => 'y') ), + 'pm' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'dynamic', + 'value' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)') + ), 'pm_max_children' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', @@ -590,6 +596,30 @@ $form["tabs"]['advanced'] = array ( 'width' => '3', 'maxlength' => '3' ), + 'pm_process_idle_timeout' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([1-9][0-9]{0,10})$/', + 'errmsg'=> 'pm_process_idle_timeout_error_regex'), + ), + 'default' => '10', + 'value' => '', + 'width' => '3', + 'maxlength' => '6' + ), + 'pm_max_requests' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^([0-9]{1,11})$/', + 'errmsg'=> 'pm_max_requests_error_regex'), + ), + 'default' => '0', + 'value' => '', + 'width' => '3', + 'maxlength' => '6' + ), 'php_open_basedir' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', diff --git a/interface/web/sites/lib/lang/de_web_domain.lng b/interface/web/sites/lib/lang/de_web_domain.lng index a1e9975c405d041d012bf1a96a24fba67e62fc9e..6f941db93a0ff61d64f1ee7d3a1eea80fb7247b7 100644 --- a/interface/web/sites/lib/lang/de_web_domain.lng +++ b/interface/web/sites/lib/lang/de_web_domain.lng @@ -92,4 +92,10 @@ $wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers muß $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"] = 'PHP-Version'; +$wb["pm_txt"] = 'PHP-FPM Process Manager'; +$wb["pm_process_idle_timeout_txt"] = 'PHP-FPM pm.process_idle_timeout'; +$wb["pm_max_requests_txt"] = 'PHP-FPM pm.max_requests'; +$wb["pm_process_idle_timeout_error_regex"] = 'PHP-FPM pm.process_idle_timeout muß eine positive ganze Zahl sein.'; +$wb["pm_max_requests_error_regex"] = 'PHP-FPM pm.max_requests muß eine ganze Zahl >= 0 sein.'; +$wb["pm_ondemand_hint_txt"] = 'Bitte beachten Sie, daß Ihre PHP-Version >= 5.3.9 sein muß, wenn Sie den ondemand Process-Manager nutzen möchten. Wenn Sie ondemand für eine ältere PHP-Version auswählen, wird PHP nicht mehr starten!'; ?> diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng index 0b4f7fc5fe6ab867d6b2754aee0e44e96e5f568d..b16af757aa8d2997a3574b61e0b7c1ea197b2bc7 100644 --- a/interface/web/sites/lib/lang/en_web_domain.lng +++ b/interface/web/sites/lib/lang/en_web_domain.lng @@ -92,4 +92,10 @@ $wb["pm_max_spare_servers_error_regex"] = 'PHP-FPM pm.max_spare_servers must be $wb["hd_quota_error_regex"] = 'Harddisk quota is invalid.'; $wb["traffic_quota_error_regex"] = 'Traffic quota is invalid.'; $wb["fastcgi_php_version_txt"] = 'PHP Version'; +$wb["pm_txt"] = 'PHP-FPM Process Manager'; +$wb["pm_process_idle_timeout_txt"] = 'PHP-FPM pm.process_idle_timeout'; +$wb["pm_max_requests_txt"] = 'PHP-FPM pm.max_requests'; +$wb["pm_process_idle_timeout_error_regex"] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.'; +$wb["pm_max_requests_error_regex"] = 'PHP-FPM pm.max_requests must be an integer value >= 0.'; +$wb["pm_ondemand_hint_txt"] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!'; ?> \ No newline at end of file diff --git a/interface/web/sites/templates/web_domain_advanced.htm b/interface/web/sites/templates/web_domain_advanced.htm index 9665f423dca243d040b8bc0131a04f50ccfb352b..a9819e017e4f5f91bdd7fc475f0b756e25e80210 100644 --- a/interface/web/sites/templates/web_domain_advanced.htm +++ b/interface/web/sites/templates/web_domain_advanced.htm @@ -20,28 +20,47 @@ -
+
+

{tmpl_var name='php_fpm_use_socket_txt'}

{tmpl_var name='php_fpm_use_socket'}
-
+
+ + +
+
+ {tmpl_var name='pm_ondemand_hint_txt'} +
+
-
+
-
+
-
+
+
+ +  s +
+
+ + +
+
@@ -75,6 +94,30 @@ getServerId(); adjustForm(); + var pm = jQuery('#pm').val(); + pmMode(pm); + jQuery('#pm').change(function(){ + pm = jQuery(this).val(); + pmMode(pm); + }); + + function pmMode(pm){ + switch(pm){ + case "static": + jQuery('.pm_dynamic').add('.pm_ondemand').hide(); + jQuery('.pm_static').show(); + break; + case "dynamic": + jQuery('.pm_static').add('.pm_ondemand').hide(); + jQuery('.pm_dynamic').show(); + break; + case "ondemand": + jQuery('.pm_static').add('.pm_dynamic').hide(); + jQuery('.pm_ondemand').show(); + break; + } + } + function getServerId(){ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getserverid"}, function(data) { serverId = data.serverid; diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 8e463ad97f38013fb4b720183fb1a602517a51ba..95c3b8b11a9fe23b030db958dbc39452794a79f8 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -518,7 +518,7 @@ class page_action extends tform_actions { } // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0 - if(isset($this->dataRecord['pm_max_children'])) { + if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') { if(intval($this->dataRecord['pm_max_children']) >= intval($this->dataRecord['pm_max_spare_servers']) && intval($this->dataRecord['pm_max_spare_servers']) >= intval($this->dataRecord['pm_start_servers']) && intval($this->dataRecord['pm_start_servers']) >= intval($this->dataRecord['pm_min_spare_servers']) && intval($this->dataRecord['pm_min_spare_servers']) > 0){ } else { diff --git a/server/conf/php_fpm_pool.conf.master b/server/conf/php_fpm_pool.conf.master index cd1ba125ac2b57be1d3a4d5534dd79b8dde9ced1..b8fce1750d0d0df4333d9e1d962fddf31c5ffbe2 100644 --- a/server/conf/php_fpm_pool.conf.master +++ b/server/conf/php_fpm_pool.conf.master @@ -14,11 +14,17 @@ listen.mode = 0660 user = group = -pm = dynamic +pm = pm.max_children = + pm.start_servers = pm.min_spare_servers = pm.max_spare_servers = + + +pm.process_idle_timeout = s; + +pm.max_requests = chdir = / diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 4315dfa45d0f1b655c890c9f241eefe8117cff84..55d65432f91a57b3353ab14c2446c3825741a58c 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -2005,10 +2005,13 @@ class apache2_plugin { $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); $tpl->setVar('fpm_user', $data['new']['system_user']); $tpl->setVar('fpm_group', $data['new']['system_group']); + $tpl->setVar('pm', $data['new']['pm']); $tpl->setVar('pm_max_children', $data['new']['pm_max_children']); $tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']); $tpl->setVar('pm_min_spare_servers', $data['new']['pm_min_spare_servers']); $tpl->setVar('pm_max_spare_servers', $data['new']['pm_max_spare_servers']); + $tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']); + $tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']); $tpl->setVar('document_root', $data['new']['document_root']); $tpl->setVar('security_level',$web_config['security_level']); $php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']); diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 2619898b9e73bdd7181e8060d0f91cb8f4096cae..af5972ea29a3c47d15a647fd50d5d1f0e4da5333 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -1630,10 +1630,13 @@ class nginx_plugin { $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); $tpl->setVar('fpm_user', $data['new']['system_user']); $tpl->setVar('fpm_group', $data['new']['system_group']); + $tpl->setVar('pm', $data['new']['pm']); $tpl->setVar('pm_max_children', $data['new']['pm_max_children']); $tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']); $tpl->setVar('pm_min_spare_servers', $data['new']['pm_min_spare_servers']); $tpl->setVar('pm_max_spare_servers', $data['new']['pm_max_spare_servers']); + $tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']); + $tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']); $tpl->setVar('document_root', $data['new']['document_root']); $tpl->setVar('security_level',$web_config['security_level']); $php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);