diff --git a/install/sql/incremental/upd_0031.sql b/install/sql/incremental/upd_0031.sql new file mode 100644 index 0000000000000000000000000000000000000000..f14e1264adc78926fc06c3faf7eea2f012165058 --- /dev/null +++ b/install/sql/incremental/upd_0031.sql @@ -0,0 +1 @@ +ALTER TABLE `web_domain` ADD `fastcgi_php_version` VARCHAR( 255 ) NULL DEFAULT NULL; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 8055d8277e93deefe5cb81c02da5a05a8655a407..a755adfa304b664152bb7c5d64e53104d863c9c2 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1549,6 +1549,7 @@ CREATE TABLE `web_domain` ( `backup_copies` INT NOT NULL DEFAULT '1', `active` enum('n','y') NOT NULL default 'y', `traffic_quota_lock` enum('n','y') NOT NULL default 'n', + `fastcgi_php_version` varchar(255) DEFAULT NULL, PRIMARY KEY (`domain_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 275fa7ace326712fc4d90939bb86a4b5cc9d4a0a..9f6f30cc89ff56c58e407c6fcd370b6af0958c32 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -90,6 +90,7 @@ fastcgi_children=8 fastcgi_max_requests=5000 fastcgi_bin=/usr/bin/php-cgi fastcgi_config_syntax=1 +fastcgi_additional_php_versions= [jailkit] jailkit_chroot_home=/home/[username] diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index 24f3f18c64984250110f31c76e2a3971b9eba1dd..facc193e4559c40c704acc318c55dd8b5af3957c 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -867,6 +867,14 @@ $form["tabs"]['fastcgi'] = array( 'width' => '40', 'maxlength' => '255' ), + 'fastcgi_additional_php_versions' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), ################################## # ENDE Datatable fields ################################## diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng index fd78f1bcedf6fb282989d957dd6762e47586a241..7911e94814225274cba1ec91ae9f76b7e0cd96fb 100644 --- a/interface/web/admin/lib/lang/de_server_config.lng +++ b/interface/web/admin/lib/lang/de_server_config.lng @@ -153,4 +153,6 @@ $wb['set_folder_permissions_on_update_txt'] = 'Set folder permissions on update' $wb['add_web_users_to_sshusers_group_txt'] = 'Add web users to -sshusers- group'; $wb['connect_userid_to_webid_txt'] = 'Connect Linux userid to webid'; $wb['connect_userid_to_webid_start_txt'] = 'Start ID for userid/webid connect'; +$wb["fastcgi_additional_php_versions_txt"] = 'Zusätzliche PHP-Versionen'; +$wb["fastcgi_additional_php_versions_hint_txt"] = 'Format:
<name>;<path_to_executable>;<path_to_php.ini_dir>
z.B.:
PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/'; ?> diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng index 4cce27548246f6fbd52ac2086498f24ba3c9efdd..c6a80f2de1b3de3166c1048cb0843cf6a4289c82 100644 --- a/interface/web/admin/lib/lang/en_server_config.lng +++ b/interface/web/admin/lib/lang/en_server_config.lng @@ -157,4 +157,6 @@ $wb["connect_userid_to_webid_txt"] = 'Connect Linux userid to webid'; $wb["connect_userid_to_webid_start_txt"] = 'Start ID for userid/webid connect'; $wb["realtime_blackhole_list_txt"] = 'Real-time Blackhole List'; $wb["realtime_blackhole_list_note_txt"] = '(Separate RBL\'s with commas)'; +$wb["fastcgi_additional_php_versions_txt"] = 'Additional PHP Versions'; +$wb["fastcgi_additional_php_versions_hint_txt"] = 'Format:
<name>;<path_to_executable>;<path_to_php.ini_dir>
e.g.:
PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/'; ?> \ No newline at end of file diff --git a/interface/web/admin/templates/server_config_fastcgi_edit.htm b/interface/web/admin/templates/server_config_fastcgi_edit.htm index 3ca49c5d6495888ab76063b58f4e8e63e9472231..0f051f5b6d25b66e5e397fb0e2f342efd922567b 100644 --- a/interface/web/admin/templates/server_config_fastcgi_edit.htm +++ b/interface/web/admin/templates/server_config_fastcgi_edit.htm @@ -39,6 +39,10 @@ {tmpl_var name='fastcgi_config_syntax'} +
+ + {tmpl_var name='fastcgi_additional_php_versions_hint_txt'} +
diff --git a/interface/web/sites/ajax_get_fastcgi_php_versions.php b/interface/web/sites/ajax_get_fastcgi_php_versions.php new file mode 100644 index 0000000000000000000000000000000000000000..41d2536e547a6ae540fb1847c86bf70a6fe7bd42 --- /dev/null +++ b/interface/web/sites/ajax_get_fastcgi_php_versions.php @@ -0,0 +1,58 @@ +auth->check_module_permissions('sites'); + +$server_id = intval($_GET["server_id"]); +$client_group_id = intval($_GET["client_group_id"]); + +if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + + $app->uses('ini_parser,getconf'); + $fastcgi = $app->getconf->get_server_config($server_id,'fastcgi'); + $php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']); + + $php_select = ""; + + if(is_array($php_versions)) { + foreach( $php_versions as $php_version) { + $php_select .= "#$php_version"; + } + } + + unset($php_versions); +} + +echo $php_select; +?> \ No newline at end of file diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php index af05cdfa1352d02302f9eb677edd77e2f71beda3..5e79c1940338369968fc20043b955910e1c91f68 100644 --- a/interface/web/sites/form/web_domain.tform.php +++ b/interface/web/sites/form/web_domain.tform.php @@ -210,6 +210,17 @@ $form["tabs"]['domain'] = array ( 'valuelimit' => 'client:web_php_options', 'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP') ), + 'fastcgi_php_version' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + /*'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address", + 'keyfield'=> 'ip_address', + 'valuefield'=> 'ip_address' + ),*/ + 'value' => '' + ), 'ruby' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', diff --git a/interface/web/sites/lib/lang/de_web_domain.lng b/interface/web/sites/lib/lang/de_web_domain.lng index 2cfebf21659fa69c797a5606b7975376149babee..27a74ba9b32914a27dc4275300480df419e09410 100644 --- a/interface/web/sites/lib/lang/de_web_domain.lng +++ b/interface/web/sites/lib/lang/de_web_domain.lng @@ -89,4 +89,5 @@ $wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children muß eine pos $wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers muß eine positive ganze Zahl sein.'; $wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers muß eine positive ganze Zahl sein.'; $wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers muß eine positive ganze Zahl sein.'; +$wb["fastcgi_php_version_txt"] = 'FastCGI-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 b7fcc679f97dcef618129badd74a6bb7c87cab3a..bd6becf7b9610a1e3de7c4abecddb92571fe8c31 100644 --- a/interface/web/sites/lib/lang/en_web_domain.lng +++ b/interface/web/sites/lib/lang/en_web_domain.lng @@ -89,4 +89,5 @@ $wb["pm_max_children_error_regex"] = 'PHP-FPM pm.max_children must be a positive $wb["pm_start_servers_error_regex"] = 'PHP-FPM pm.start_servers must be a positive integer value.'; $wb["pm_min_spare_servers_error_regex"] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.'; $wb["pm_max_spare_servers_error_regex"] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.'; +$wb["fastcgi_php_version_txt"] = 'FastCGI 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 178c639ed20c17865f8be2c7e0ebe562d71dba22..064cf27e6c0556b906442503ac329a81af944ab4 100644 --- a/interface/web/sites/templates/web_domain_edit.htm +++ b/interface/web/sites/templates/web_domain_edit.htm @@ -121,6 +121,12 @@ + +
+ +

{tmpl_var name='active_txt'}

@@ -151,6 +157,7 @@ serverId = $(this).val(); adjustForm(); reloadWebIP(); + reloadFastcgiPHPVersions(); }); } adjustForm(); @@ -160,6 +167,14 @@ reloadWebIP(); }); + jQuery('#php').change(function(){ + if(jQuery(this).val() == 'fast-cgi'){ + jQuery('.fastcgi_php_version').show(); + } else { + jQuery('.fastcgi_php_version').hide(); + } + }); + function adjustForm(){ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) { if(data.servertype == "nginx"){ @@ -184,5 +199,9 @@ loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+serverId+'&client_group_id='+clientGroupId); loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId+'&client_group_id='+clientGroupId); } + + function reloadFastcgiPHPVersions() { + loadOptionInto('fastcgi_php_version','sites/ajax_get_fastcgi_php_versions.php?server_id='+serverId+'&client_group_id='+clientGroupId); + } diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index e510bfe5242338edfef89b18ff59cbe7f46e0023..d861cdb146ef8eb58dfe22d949cc20b2b00c6db8 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -45,7 +45,7 @@ require_once('../../lib/app.inc.php'); $app->auth->check_module_permissions('sites'); // Loading classes -$app->uses('tpl,tform,tform_actions'); +$app->uses('tpl,tform,tform_actions,ini_parser,getconf'); $app->load('tform_actions'); class page_action extends tform_actions { @@ -128,6 +128,19 @@ class page_action extends tform_actions { $app->tpl->setVar("ipv6_address",$ip_select); unset($tmp); unset($ips); + + //PHP Version Selection (FastCGI) + $fastcgi = $app->getconf->get_server_config($client['default_webserver'],'fastcgi'); + $php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']); + $php_select = ""; + if(is_array($php_versions)) { + foreach( $php_versions as $php_version) { + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version",$php_select); + unset($php_versions); //* Reseller: If the logged in user is not admin and has sub clients (is a reseller) } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { @@ -184,6 +197,19 @@ class page_action extends tform_actions { $app->tpl->setVar("ipv6_address",$ip_select); unset($tmp); unset($ips); + + //PHP Version Selection (FastCGI) + $fastcgi = $app->getconf->get_server_config($client['default_webserver'],'fastcgi'); + $php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']); + $php_select = ""; + if(is_array($php_versions)) { + foreach( $php_versions as $php_version) { + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version",$php_select); + unset($php_versions); //* Admin: If the logged in user is admin } else { @@ -226,6 +252,19 @@ class page_action extends tform_actions { $app->tpl->setVar("ipv6_address",$ip_select); unset($tmp); unset($ips); + + //PHP Version Selection (FastCGI) + $fastcgi = $app->getconf->get_server_config($server_id,'fastcgi'); + $php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']); + $php_select = ""; + if(is_array($php_versions)) { + foreach( $php_versions as $php_version) { + $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; + $php_select .= "\r\n"; + } + } + $app->tpl->setVar("fastcgi_php_version",$php_select); + unset($php_versions); // Fill the client select field $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name"; diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 66940a55db023d6800f497e42ffafc493de19e04..e9a66c40ec3a0f717db053d92abb609a60a192df 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -909,15 +909,32 @@ class apache2_plugin { $fcgi_tpl = new tpl(); $fcgi_tpl->newTemplate('php-fcgi-starter.master'); + // Support for multiple PHP versions (FastCGI) + if(trim($data['new']['fastcgi_php_version']) != ''){ + $default_fastcgi_php = false; + list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(';', trim($data['new']['fastcgi_php_version'])); + if(substr($custom_fastcgi_php_ini_dir,-1) != '/') $custom_fastcgi_php_ini_dir .= '/'; + } else { + $default_fastcgi_php = true; + } + if($has_custom_php_ini) { $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir)); } else { - $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); + if($default_fastcgi_php){ + $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); + } else { + $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_fastcgi_php_ini_dir)); + } } $fcgi_tpl->setVar('document_root',escapeshellcmd($data['new']['document_root'])); $fcgi_tpl->setVar('php_fcgi_children',escapeshellcmd($fastcgi_config['fastcgi_children'])); $fcgi_tpl->setVar('php_fcgi_max_requests',escapeshellcmd($fastcgi_config['fastcgi_max_requests'])); - $fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin'])); + if($default_fastcgi_php){ + $fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin'])); + } else { + $fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($custom_fastcgi_php_executable)); + } $fcgi_tpl->setVar('security_level',intval($web_config['security_level'])); $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];