From a2ab73fa413733e14d98e1659f8182ce7ca17565 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Tue, 27 Jul 2010 08:42:59 +0000 Subject: [PATCH] - add possibility to use FCGID also for Froxlor itself, fixes #305 - make extra settings menu for FCGID - replace deprecated function 'ereg_replace' in lighttpd-cronjob --- actions/admin/settings/135.fcgid.php | 125 ++++++++++++++++++ actions/admin/settings/210.security.php | 72 ---------- install/froxlor.sql | 7 +- .../updates/froxlor/0.9/update_0.9.inc.php | 26 +++- .../preconfig/0.9/preconfig_0.9.inc.php | 17 +++ lng/english.lng.php | 9 +- lng/german.lng.php | 7 + .../jobs/cron_tasks.inc.http.10.apache.php | 28 ++++ .../cron_tasks.inc.http.15.apache_fcgid.php | 83 ++++++++++++ .../jobs/cron_tasks.inc.http.20.lighttpd.php | 6 +- scripts/jobs/cron_tasks.php | 1 + templates/main.css | 1 + 12 files changed, 305 insertions(+), 77 deletions(-) create mode 100644 actions/admin/settings/135.fcgid.php diff --git a/actions/admin/settings/135.fcgid.php b/actions/admin/settings/135.fcgid.php new file mode 100644 index 00000000..ed43d2b1 --- /dev/null +++ b/actions/admin/settings/135.fcgid.php @@ -0,0 +1,125 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Settings + * @version $Id$ + */ + +return array( + 'groups' => array( + 'fcgid' => array( + 'title' => $lng['admin']['fcgid_settings'], + 'fields' => array( + 'system_mod_fcgid_enabled' => array( + 'label' => $lng['serversettings']['mod_fcgid'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid', + 'type' => 'bool', + 'default' => false, + 'save_method' => 'storeSettingField', + 'overview_option' => true + ), + 'system_mod_fcgid_enabled_ownvhost' => array( + 'label' => $lng['serversettings']['mod_fcgid_ownvhost'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_ownvhost', + 'type' => 'bool', + 'default' => false, + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_httpuser' => array( + 'label' => $lng['admin']['mod_fcgid_user'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_httpuser', + 'type' => 'string', + 'default' => 'froxlorlocal', + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_httpgroup' => array( + 'label' => $lng['admin']['mod_fcgid_group'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_httpgroup', + 'type' => 'string', + 'default' => 'froxlorlocal', + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_configdir' => array( + 'label' => $lng['serversettings']['mod_fcgid']['configdir'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_configdir', + 'type' => 'string', + 'string_type' => 'dir', + 'default' => '/var/www/php-fcgi-scripts/', + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_tmpdir' => array( + 'label' => $lng['serversettings']['mod_fcgid']['tmpdir'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_tmpdir', + 'type' => 'string', + 'string_type' => 'dir', + 'default' => '/var/customers/tmp/', + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_peardir' => array( + 'label' => $lng['serversettings']['mod_fcgid']['peardir'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_peardir', + 'type' => 'string', + 'string_type' => 'dir', + 'string_delimiter' => ':', + 'string_emptyallowed' => true, + 'default' => '/usr/share/php/:/usr/share/php5/', + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_wrapper' => array( + 'label' => $lng['serversettings']['mod_fcgid']['wrapper'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_wrapper', + 'type' => 'option', + 'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'), + 'default' => 1, + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_starter' => array( + 'label' => $lng['serversettings']['mod_fcgid']['starter'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_starter', + 'type' => 'int', + 'default' => 0, + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_maxrequests' => array( + 'label' => $lng['serversettings']['mod_fcgid']['maxrequests'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_maxrequests', + 'type' => 'int', + 'default' => 250, + 'save_method' => 'storeSettingField', + ), + 'system_mod_fcgid_defaultini' => array( + 'label' => $lng['serversettings']['mod_fcgid']['defaultini'], + 'settinggroup' => 'system', + 'varname' => 'mod_fcgid_defaultini', + 'type' => 'option', + 'default' => '1', + 'option_mode' => 'one', + 'option_options_method' => 'getPhpConfigs', + 'save_method' => 'storeSettingField', + ), + ), + ), + ), + ); + +?> diff --git a/actions/admin/settings/210.security.php b/actions/admin/settings/210.security.php index 095552a7..3874d119 100644 --- a/actions/admin/settings/210.security.php +++ b/actions/admin/settings/210.security.php @@ -38,78 +38,6 @@ return array( 'default' => true, 'save_method' => 'storeSettingField', ), - 'system_mod_fcgid_enabled' => array( - 'label' => $lng['serversettings']['mod_fcgid'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid', - 'type' => 'bool', - 'default' => false, - 'save_method' => 'storeSettingField', - ), - 'system_mod_fcgid_configdir' => array( - 'label' => $lng['serversettings']['mod_fcgid']['configdir'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid_configdir', - 'type' => 'string', - 'string_type' => 'dir', - 'default' => '/var/www/php-fcgi-scripts/', - 'save_method' => 'storeSettingField', - ), - 'system_mod_fcgid_tmpdir' => array( - 'label' => $lng['serversettings']['mod_fcgid']['tmpdir'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid_tmpdir', - 'type' => 'string', - 'string_type' => 'dir', - 'default' => '/var/customers/tmp/', - 'save_method' => 'storeSettingField', - ), - 'system_mod_fcgid_peardir' => array( - 'label' => $lng['serversettings']['mod_fcgid']['peardir'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid_peardir', - 'type' => 'string', - 'string_type' => 'dir', - 'string_delimiter' => ':', - 'string_emptyallowed' => true, - 'default' => '/usr/share/php/:/usr/share/php5/', - 'save_method' => 'storeSettingField', - ), - 'system_mod_fcgid_wrapper' => array( - 'label' => $lng['serversettings']['mod_fcgid']['wrapper'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid_wrapper', - 'type' => 'option', - 'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'), - 'default' => 0, - 'save_method' => 'storeSettingField', - ), - 'system_mod_fcgid_starter' => array( - 'label' => $lng['serversettings']['mod_fcgid']['starter'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid_starter', - 'type' => 'int', - 'default' => 0, - 'save_method' => 'storeSettingField', - ), - 'system_mod_fcgid_maxrequests' => array( - 'label' => $lng['serversettings']['mod_fcgid']['maxrequests'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid_maxrequests', - 'type' => 'int', - 'default' => 250, - 'save_method' => 'storeSettingField', - ), - 'system_mod_fcgid_defaultini' => array( - 'label' => $lng['serversettings']['mod_fcgid']['defaultini'], - 'settinggroup' => 'system', - 'varname' => 'mod_fcgid_defaultini', - 'type' => 'option', - 'default' => '1', - 'option_mode' => 'one', - 'option_options_method' => 'getPhpConfigs', - 'save_method' => 'storeSettingField', - ), ), ), ), diff --git a/install/froxlor.sql b/install/froxlor.sql index c4c8636c..04c5222c 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -454,7 +454,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload'); -INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.11'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.12-svn1'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900'); @@ -526,7 +526,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (92, 'admin', 'show_version_login', '0'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (93, 'admin', 'show_version_footer', '0'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (94, 'admin', 'froxlor_graphic', 'images/header.gif'); -INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (95, 'system', 'mod_fcgid_wrapper', '0'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (95, 'system', 'mod_fcgid_wrapper', '1'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (96, 'system', 'mod_fcgid_starter', '0'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (97, 'system', 'mod_fcgid_peardir', '/usr/share/php/:/usr/share/php5/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (98, 'system', 'index_file_extension', 'html'); @@ -577,6 +577,9 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (143, 'system', 'froxlordirectlyviahostname', '0'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (144, 'panel', 'password_regex', ''); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (145, 'system', 'perl_path', '/usr/bin/perl'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (146, 'system', 'mod_fcgid_ownvhost', '0'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (147, 'system', 'mod_fcgid_httpuser', 'froxlorlocal'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (148, 'system', 'mod_fcgid_httpgroup', 'froxlorlocal'); # -------------------------------------------------------- diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index dbb4ef98..92f3b7f4 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -925,8 +925,32 @@ if(isFroxlorVersion('0.9.11-svn2')) if(isFroxlorVersion('0.9.11-svn3')) { - showUpdateStep("Updating from 0.9.11-svn3 to 0.9.11 final", false); + showUpdateStep("Updating from 0.9.11-svn3 to 0.9.11 final"); lastStepStatus(0); updateToVersion('0.9.11'); } + +if(isFroxlorVersion('0.9.11')) +{ + showUpdateStep("Updating from 0.9.11 to 0.9.12-svn1", false); + + $update_fcgid_ownvhost = isset($_POST['update_fcgid_ownvhost']) ? '1' : '0'; + $update_fcgid_httpuser = isset($_POST['update_fcgid_httpuser']) ? $_POST['update_fcgid_httpuser'] : 'froxlorlocal'; + $update_fcgid_httpgroup = isset($_POST['update_fcgid_ownvhost']) ? $_POST['update_fcgid_ownvhost'] : 'froxlorlocal'; + + if($update_fcgid_httpuser == '') { + $update_fcgid_httpuser = 'froxlorlocal'; + } + if($update_fcgid_httpgroup == '') { + $update_fcgid_httpgroup = 'froxlorlocal'; + } + + showUpdateStep("Adding new settings"); + $db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_ownvhost', '".$db->escape($update_fcgid_ownvhost)."');"); + $db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_httpuser', '".$db->escape($update_fcgid_httpuser)."');"); + $db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_httpgroup', '".$db->escape($update_fcgid_httpgroup)."');"); + lastStepStatus(0); + + updateToVersion('0.9.12-svn1'); +} diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index 889d8625..74c5fca9 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -238,4 +238,21 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) $question.= ''; eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); } + + if(versionInUpdate($current_version, '0.9.12-svn1')) + { + if($settings['system']['mod_fcgid'] == 1) + { + $has_preconfig = true; + $description = 'You can chose whether you want Froxlor to use FCGID itself too now.'; + $question = 'Use FCGID for the Froxlor Panel?: '; + $question.= makeyesno('update_fcgid_ownvhost', '1', '0', '0').'

'; + $question.= 'If \'yes\', please specify local user/group (have to exist, Froxlor does not add them automatically):

'; + $question.= 'Local user: '; + $question.= '

'; + $question.= 'Local group: '; + $question.= '
'; + eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); + } + } } diff --git a/lng/english.lng.php b/lng/english.lng.php index 2a1d4c26..dc5153f6 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1448,7 +1448,14 @@ $lng['extras']['execute_perl'] = 'Execute perl/CGI'; $lng['admin']['perlenabled'] = 'Perl enabled'; // ADDED IN FROXLOR 0.9.11-svn3 -$lng['serversettings']['perl_path']['title'] = 'Path zu perl'; +$lng['serversettings']['perl_path']['title'] = 'Path to perl'; $lng['serversettings']['perl_path']['description'] = 'Only relevant if you use lighttpd. Default is /usr/bin/perl'; +// ADDED IN FROXLOR 0.9.12-svn1 +$lng['admin']['fcgid_settings'] = 'FCGID'; +$lng['serversettings']['mod_fcgid_ownvhost']['title'] = 'Enable FCGID for the Froxlor vhost'; +$lng['serversettings']['mod_fcgid_ownvhost']['description'] = 'If enabled, Froxlor will also be running under a local user
ATTENTION:This needs manual configuration, see http://wiki.froxlor.org/contrib/fcgid-handbook'; +$lng['admin']['mod_fcgid_user'] = 'Local user to use for FCGID (Froxlor vhost)'; +$lng['admin']['mod_fcgid_group'] = 'Local group to use for FCGID (Froxlor vhost)'; + ?> diff --git a/lng/german.lng.php b/lng/german.lng.php index 2fc44a30..9fe2580e 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1434,4 +1434,11 @@ $lng['admin']['perlenabled'] = 'Perl verfügbar'; $lng['serversettings']['perl_path']['title'] = 'Pfad zu Perl'; $lng['serversettings']['perl_path']['description'] = 'Nur nötig für lighttpd-Nutzer. Standard ist /usr/bin/perl'; +// ADDED IN FROXLOR 0.9.12-svn1 +$lng['admin']['fcgid_settings'] = 'FCGID'; +$lng['serversettings']['mod_fcgid_ownvhost']['title'] = 'Verwende FCGID im Froxlor Vhost'; +$lng['serversettings']['mod_fcgid_ownvhost']['description'] = 'Wenn verwendet, wird Froxlor selbst unter einem lokalem Benutzer ausgeführt
ACHTUNG:Hierzu müssen noch zusätzliche Konfigurationen vorgenommen werden, siehe http://wiki.froxlor.org/contrib/fcgid-handbook'; +$lng['admin']['mod_fcgid_user'] = 'Lokaler Benutzer für FCGID (Froxlor Vhost)'; +$lng['admin']['mod_fcgid_group'] = 'Lokale Gruppe für FCGID (Froxlor Vhost)'; + ?> diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index c84b0fcb..68b52b49 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -207,6 +207,30 @@ class apache $this->virtualhosts_data[$vhosts_filename].= ' ServerName ' . $this->settings['system']['hostname'] . "\n"; } + // create fcgid -Part (starter is created in apache_fcgid) + if($this->settings['system']['mod_fcgid_ownvhost'] == '1') + { + + $configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/'); + if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0) + { + $this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' ScriptAlias /php/ ' . $configdir . "\n"; + } + else + { + $starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter'); + $this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' ' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' AddHandler fcgid-script .php' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' FCGIWrapper ' . $starter_filename . ' .php' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' Options +ExecCGI' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' Order allow,deny' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' allow from all' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' ' . "\n"; + } + } + /** * dirprotection, see #72 * @TODO deferred until 0.9.5, needs more testing @@ -327,6 +351,10 @@ class apache return $php_options_text; } + + public function createOwnVhostStarter() + { + } /* * We collect all servernames and Aliases diff --git a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php index 6190c59b..684b395e 100644 --- a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php +++ b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php @@ -278,6 +278,89 @@ class apache_fcgid extends apache return $this->admin_cache[$adminid]; } + + public function createOwnVhostStarter() + { + if ($this->settings['system']['mod_fcgid_ownvhost'] == '1') + { + $mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown + $configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/'); + $starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter'); + $tmpdir = makeCorrectDir($this->settings['system']['mod_fcgid_tmpdir'] . '/froxlor.panel/'); + + $user = $this->settings['system']['mod_fcgid_httpuser']; + $group = $this->settings['system']['mod_fcgid_httpgroup']; + + // all the files and folders have to belong to the local user + // now because we also use fcgid for our own vhost + safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath)); + + // create config dir if necessary + if(!is_dir($configdir)) + { + safe_exec('mkdir -p ' . escapeshellarg($configdir)); + safe_exec('chown ' . $user . ':' . $group . ' ' . escapeshellarg($configdir)); + } + + // create tmp dir if necessary + if(!is_dir($tmpdir)) + { + safe_exec('mkdir -p ' . escapeshellarg($tmpdir)); + safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($tmpdir)); + safe_exec('chmod 0750 ' . escapeshellarg($tmpdir)); + } + + // we only need this for some basic, no special parameters that + // would require to maybe allow selecting a specific php.ini + // because we only need the binary and spawning parameters + $phpconfig = $this->getPhpConfig(0); + + // create starter + $starter_file = "#!/bin/sh\n\n"; + $starter_file.= "#\n"; + $starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for the Froxlor vhost\n"; + $starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n"; + $starter_file.= "#\n\n"; + $starter_file.= "umask 022\n"; + $starter_file.= "PHPRC=" . escapeshellarg($configdir) . "\n"; + $starter_file.= "export PHPRC\n"; + if((int)$phpconfig['mod_fcgid_starter'] != - 1) + { + $starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n"; + } + else + { + $starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->settings['system']['mod_fcgid_starter'] . "\n"; + } + $starter_file.= "export PHP_FCGI_CHILDREN\n"; + if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1) + { + $starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n"; + } + else + { + $starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->settings['system']['mod_fcgid_maxrequests'] . "\n"; + } + $starter_file.= "export PHP_FCGI_MAX_REQUESTS\n"; + + // Set Binary + $starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($configdir) . "\n"; + + //remove +i attibute, so starter can be overwritten + if(file_exists($starter_filename)) + { + safe_exec('chattr -i ' . escapeshellarg($starter_filename)); + } + + $starter_file_handler = fopen($starter_filename, 'w'); + fwrite($starter_file_handler, $starter_file); + fclose($starter_file_handler); + safe_exec('chmod 750 ' . escapeshellarg($starter_filename)); + safe_exec('chown ' . $user . ':' . $group . ' ' . escapeshellarg($starter_filename)); + safe_exec('chattr +i ' . escapeshellarg($starter_filename)); + } + } + } ?> diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index 3ae66a04..320cb494 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -244,6 +244,10 @@ class lighttpd { } + public function createOwnVhostStarter() + { + } + protected function createLighttpdHosts($ip, $port, $ssl, $vhost_filename) { $query = "SELECT * FROM " . TABLE_PANEL_IPSANDPORTS . " WHERE `ip`='" . $ip . "' AND `port`='" . $port . "'"; @@ -612,7 +616,7 @@ class lighttpd protected function getServerNames($domain) { $server_string = array(); - $domain_name = ereg_replace('\.', '\.', $domain['domain']); + $domain_name = str_replace('.', '\.', $domain['domain']); if($domain['iswildcarddomain'] == '1') { diff --git a/scripts/jobs/cron_tasks.php b/scripts/jobs/cron_tasks.php index d1678108..78e51724 100644 --- a/scripts/jobs/cron_tasks.php +++ b/scripts/jobs/cron_tasks.php @@ -123,6 +123,7 @@ $awstatsclean['headerold']) { $webserver->createVirtualHosts(); $webserver->createFileDirOptions(); $webserver->writeConfigs(); + $webserver->createOwnVhostStarter(); $webserver->reload(); } else diff --git a/templates/main.css b/templates/main.css index 711c6a69..5bf22aeb 100644 --- a/templates/main.css +++ b/templates/main.css @@ -468,4 +468,5 @@ TR.RowOverSelected { { display: block; margin-bottom: 0.5em; + font-size: 120%; }