- Added support for multiple PHP versions (Apache + PHP-FastCGI).
12 files modified
2 files added
New file |
| | |
| | | ALTER TABLE `web_domain` ADD `fastcgi_php_version` VARCHAR( 255 ) NULL DEFAULT NULL; |
| | |
| | | `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 ; |
| | | |
| | |
| | | fastcgi_max_requests=5000 |
| | | fastcgi_bin=/usr/bin/php-cgi |
| | | fastcgi_config_syntax=1 |
| | | fastcgi_additional_php_versions= |
| | | |
| | | [jailkit] |
| | | jailkit_chroot_home=/home/[username] |
| | |
| | | 'width' => '40', |
| | | 'maxlength' => '255' |
| | | ), |
| | | 'fastcgi_additional_php_versions' => array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => '', |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | | ), |
| | | ################################## |
| | | # ENDE Datatable fields |
| | | ################################## |
| | |
| | | $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:<br><name>;<path_to_executable>;<path_to_php.ini_dir><br>z.B.:<br>PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/'; |
| | | ?> |
| | |
| | | $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:<br><name>;<path_to_executable>;<path_to_php.ini_dir><br>e.g.:<br>PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/'; |
| | | ?> |
| | |
| | | {tmpl_var name='fastcgi_config_syntax'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="fastcgi_additional_php_versions">{tmpl_var name='fastcgi_additional_php_versions_txt'}</label> |
| | | <textarea rows="10" cols="40" name="fastcgi_additional_php_versions" id="fastcgi_additional_php_versions" type="text" class="textInput">{tmpl_var name='fastcgi_additional_php_versions'}</textarea> {tmpl_var name='fastcgi_additional_php_versions_hint_txt'} |
| | | </div> |
| | | </fieldset> |
| | | |
| | | <input type="hidden" name="id" value="{tmpl_var name='id'}"> |
New file |
| | |
| | | <?php |
| | | |
| | | /* |
| | | Copyright (c) 2005, Till Brehm, projektfarm Gmbh |
| | | All rights reserved. |
| | | |
| | | Redistribution and use in source and binary forms, with or without modification, |
| | | are permitted provided that the following conditions are met: |
| | | |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright notice, |
| | | this list of conditions and the following disclaimer in the documentation |
| | | and/or other materials provided with the distribution. |
| | | * Neither the name of ISPConfig nor the names of its contributors |
| | | may be used to endorse or promote products derived from this software without |
| | | specific prior written permission. |
| | | |
| | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| | | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| | | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| | | IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| | | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| | | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| | | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| | | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| | | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| | | */ |
| | | |
| | | require_once('../../lib/config.inc.php'); |
| | | require_once('../../lib/app.inc.php'); |
| | | |
| | | //* Check permissions for module |
| | | $app->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; |
| | | ?> |
| | |
| | | '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', |
| | |
| | | $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'; |
| | | ?> |
| | |
| | | $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'; |
| | | ?> |
| | |
| | | {tmpl_var name='php'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder fastcgi_php_version"> |
| | | <label for="fastcgi_php_version">{tmpl_var name='fastcgi_php_version_txt'}</label> |
| | | <select name="fastcgi_php_version" id="fastcgi_php_version" class="selectInput formLengthHalf"> |
| | | {tmpl_var name='fastcgi_php_version'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <p class="label">{tmpl_var name='active_txt'}</p> |
| | | <div class="multiField"> |
| | |
| | | serverId = $(this).val(); |
| | | adjustForm(); |
| | | reloadWebIP(); |
| | | reloadFastcgiPHPVersions(); |
| | | }); |
| | | } |
| | | adjustForm(); |
| | |
| | | jQuery('#client_group_id').change(function(){ |
| | | clientGroupId = $(this).val(); |
| | | reloadWebIP(); |
| | | }); |
| | | |
| | | jQuery('#php').change(function(){ |
| | | if(jQuery(this).val() == 'fast-cgi'){ |
| | | jQuery('.fastcgi_php_version').show(); |
| | | } else { |
| | | jQuery('.fastcgi_php_version').hide(); |
| | | } |
| | | }); |
| | | |
| | | function adjustForm(){ |
| | |
| | | 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); |
| | | } |
| | | |
| | | </script> |
| | |
| | | $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 { |
| | |
| | | $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 = "<option value=''>Default</option>"; |
| | | if(is_array($php_versions)) { |
| | | foreach( $php_versions as $php_version) { |
| | | $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; |
| | | $php_select .= "<option value='$php_version' $selected>$php_version</option>\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'])) { |
| | |
| | | $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 = "<option value=''>Default</option>"; |
| | | if(is_array($php_versions)) { |
| | | foreach( $php_versions as $php_version) { |
| | | $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; |
| | | $php_select .= "<option value='$php_version' $selected>$php_version</option>\r\n"; |
| | | } |
| | | } |
| | | $app->tpl->setVar("fastcgi_php_version",$php_select); |
| | | unset($php_versions); |
| | | |
| | | //* Admin: If the logged in user is admin |
| | | } else { |
| | |
| | | $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 = "<option value=''>Default</option>"; |
| | | if(is_array($php_versions)) { |
| | | foreach( $php_versions as $php_version) { |
| | | $selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':''; |
| | | $php_select .= "<option value='$php_version' $selected>$php_version</option>\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"; |
| | |
| | | $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']; |