diff --git a/actions/admin/settings/136.phpfpm.php b/actions/admin/settings/136.phpfpm.php index d959679f..be0e9258 100644 --- a/actions/admin/settings/136.phpfpm.php +++ b/actions/admin/settings/136.phpfpm.php @@ -56,7 +56,7 @@ return array( ), /* * @TODO implement if phpfpm knows custom php.ini files - * + * 'system_phpfpm_defaultini_ownvhost' => array( 'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'], 'settinggroup' => 'phpfpm', @@ -77,6 +77,15 @@ return array( 'default' => '/etc/php-fpm.d/', 'save_method' => 'storeSettingField', ), + 'system_phpfpm_aliasconfigdir' => array( + 'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'], + 'settinggroup' => 'phpfpm', + 'varname' => 'aliasconfigdir', + 'type' => 'string', + 'string_type' => 'dir', + 'default' => '/var/www/php-fpm/', + 'save_method' => 'storeSettingField', + ), 'system_phpfpm_tmpdir' => array( 'label' => $lng['serversettings']['mod_fcgid']['tmpdir'], 'settinggroup' => 'phpfpm', 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 451cf012..ea403c8e 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -1642,7 +1642,7 @@ if(isFroxlorVersion('0.9.22-svn1')) /* fix backup_dir for #186 */ $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/var/customers/backups/' WHERE `varname` = 'backup_dir';"); - + updateToVersion('0.9.22-svn2'); } @@ -1650,7 +1650,7 @@ if(isFroxlorVersion('0.9.22-svn2')) { showUpdateStep("Updating from 0.9.22-svn2 to 0.9.22-rc1"); lastStepStatus(0); - + updateToVersion('0.9.22-rc1'); } @@ -1658,7 +1658,7 @@ if(isFroxlorVersion('0.9.22-rc1')) { showUpdateStep("Updating from 0.9.22-rc1 to 0.9.22"); lastStepStatus(0); - + updateToVersion('0.9.22'); } @@ -1729,10 +1729,10 @@ if(isFroxlorVersion('0.9.25')) { showUpdateStep("Updating from 0.9.25 to 0.9.26-svn1"); lastStepStatus(0); - + // enable bind by default $db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'bind_enable', '1')"); - + updateToVersion('0.9.26-svn1'); } @@ -1756,24 +1756,24 @@ if(isFroxlorVersion('0.9.26')) { showUpdateStep("Updating from 0.9.26 to 0.9.27-svn1"); lastStepStatus(0); - + // check for multiple backup_ftp_enabled entries $handle = $db->query("SELECT `value` FROM `panel_settings` WHERE `varname` = 'backup_ftp_enabled';"); - + // if there are more than one entry try to fix it if ($db->num_rows($handle) > 1) { $rows = $db->fetch_array($handle); $state = false; - + // iterate through all found entries // and try to guess what value it should be foreach ($rows as $row) { $state = $state | $row['value']; } - + // now delete all entries $db->query("DELETE FROM `panel_settings` WHERE `varname` = 'backup_ftp_enabled';"); - + // and re-add it $db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'backup_ftp_enabled', '". $state ."');"); } @@ -1785,18 +1785,18 @@ if(isFroxlorVersion('0.9.27-svn1')) { showUpdateStep("Updating from 0.9.27-svn1 to 0.9.27-svn2"); lastStepStatus(0); - + // Get FastCGI timeout setting if available $handle = $db->query("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' AND `varname` = 'mod_fcgid_idle_timeout';"); - + // If timeout is set then skip if ($db->num_rows($handle) < 1) { $db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_idle_timeout', '30');"); } - + // Get FastCGI timeout setting if available $handle = $db->query("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'idle_timeout';"); - + // If timeout is set then skip if ($db->num_rows($handle) < 1) { $db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'idle_timeout', '30');"); @@ -1821,3 +1821,17 @@ if(isFroxlorVersion('0.9.27-rc1')) updateToVersion('0.9.27'); } +if(isFroxlorVersion('0.9.27')) { + showUpdateStep("Updating from 0.9.27 to 0.9.28-fpmfix"); + lastStepStatus(0); + + // Get AliasconfigDir setting if available + $handle = $db->query("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'aliasconfigdir';"); + + // If AliasconfigDir is set then skip + if ($db->num_rows($handle) < 1) { + $db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'aliasconfigdir', '/var/www/php-fpm/');"); + } + + updateToVersion('0.9.28-fpmfix'); +} diff --git a/lib/classes/phpinterface/class.phpinterface_fpm.php b/lib/classes/phpinterface/class.phpinterface_fpm.php index aceef322..1dfc0ddf 100644 --- a/lib/classes/phpinterface/class.phpinterface_fpm.php +++ b/lib/classes/phpinterface/class.phpinterface_fpm.php @@ -125,13 +125,13 @@ class phpinterface_fpm { $_phpappendopenbasedir .= appendOpenBasedirPath($cobd); } - + $_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']); foreach($_custom_openbasedir as $cobd) { $_phpappendopenbasedir .= appendOpenBasedirPath($cobd); } - + if($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false) { $openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true); @@ -140,10 +140,10 @@ class phpinterface_fpm { $openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true); } - + $openbasedir .= appendOpenBasedirPath($this->getTempDir()); $openbasedir .= $_phpappendopenbasedir; - + $openbasedir = explode(':', $openbasedir); $clean_openbasedir = array(); foreach($openbasedir as $number => $path) @@ -229,7 +229,31 @@ class phpinterface_fpm safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir)); safe_exec('chmod 0750 ' . escapeshellarg($tmpdir)); } - + return $tmpdir; } + + /** + * fastcgi-fakedirectory directory + * + * @param boolean $createifnotexists create the directory if it does not exist + * + * @return string the directory + */ + public function getAliasConfigDir($createifnotexists = true) + { + // ensure default... + if (!isset($this->_settings['phpfpm']['aliasconfigdir'])) { + $this->_settings['phpfpm']['aliasconfigdir'] = '/var/www/php-fpm'; + } + + $configdir = makeCorrectDir($this->_settings['phpfpm']['aliasconfigdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/'); + if(!is_dir($configdir) && $createifnotexists) + { + safe_exec('mkdir -p ' . escapeshellarg($configdir)); + safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir)); + } + + return $configdir; + } } diff --git a/lib/functions/formfields/function.processForm.php b/lib/functions/formfields/function.processForm.php index ae495998..a42eaa53 100644 --- a/lib/functions/formfields/function.processForm.php +++ b/lib/functions/formfields/function.processForm.php @@ -37,7 +37,7 @@ function processForm(&$form, &$input, $url_params = array()) } } } - + foreach($form['groups'] as $groupname => $groupdetails) { if(validateFieldDefinition($groupdetails)) @@ -46,7 +46,7 @@ function processForm(&$form, &$input, $url_params = array()) foreach($groupdetails['fields'] as $fieldname => $fielddetails) { $newfieldvalue = getFormFieldData($fieldname, $fielddetails, $input); - + if($newfieldvalue != $fielddetails['value']) { if(($error = validateFormField($fieldname, $fielddetails, $newfieldvalue)) !== true) @@ -173,13 +173,13 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_ } } } - + foreach($form['groups'] as $groupname => $groupdetails) { if(($settings_part && $part == $groupname) || $settings_all || $only_enabledisable - ){ + ){ if(validateFieldDefinition($groupdetails)) { // Validate fields @@ -189,7 +189,6 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_ || ($only_enabledisable && isset($fielddetails['overview_option'])) ) { $newfieldvalue = getFormFieldData($fieldname, $fielddetails, $input); - if($newfieldvalue != $fielddetails['value']) { if(($error = validateFormField($fieldname, $fielddetails, $newfieldvalue)) !== true) @@ -201,7 +200,7 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_ $changed_fields[$fieldname] = $newfieldvalue; } } - + $submitted_fields[$fieldname] = $newfieldvalue; } } diff --git a/lib/functions/settings/function.storeSettingField.php b/lib/functions/settings/function.storeSettingField.php index 0bdf6e46..21bc7ccf 100644 --- a/lib/functions/settings/function.storeSettingField.php +++ b/lib/functions/settings/function.storeSettingField.php @@ -21,6 +21,7 @@ function storeSettingField($fieldname, $fielddata, $newfieldvalue) { if(is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] != '' && isset($fielddata['varname']) && $fielddata['varname'] != '') { + if(saveSetting($fielddata['settinggroup'], $fielddata['varname'], $newfieldvalue) != false) { /* @@ -30,7 +31,7 @@ function storeSettingField($fieldname, $fielddata, $newfieldvalue) { toggleCronStatus($fielddata['cronmodule'], $newfieldvalue); } - + /* * satisfy dependencies */ @@ -47,7 +48,7 @@ function storeSettingField($fieldname, $fielddata, $newfieldvalue) else { return false; - } + } } else { @@ -66,7 +67,7 @@ function storeSettingFieldInsertBindTask($fieldname, $fielddata, $newfieldvalue) else { return false; - } + } } else { diff --git a/lng/english.lng.php b/lng/english.lng.php index dc98bab5..5e1ad674 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1527,6 +1527,7 @@ $lng['error']['intvaluetoohigh'] = 'The given number is too high (field %s)'; $lng['admin']['phpfpm_settings'] = 'PHP-FPM'; $lng['serversettings']['phpfpm'] = 'Enable php-fpm'; $lng['serversettings']['phpfpm_settings']['configdir'] = 'Configuration directory of php-fpm'; +$lng['serversettings']['phpfpm_settings']['aliasconfigdir'] = 'Configuration Alias-directory of php-fpm'; $lng['serversettings']['phpfpm_settings']['reload'] = 'php-fpm restart command'; $lng['serversettings']['phpfpm_settings']['pm'] = 'Process manager control (pm)'; $lng['serversettings']['phpfpm_settings']['max_children']['title'] = 'The number of child processes'; diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index c64ba5ba..63ca8091 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -30,21 +30,21 @@ class apache private $logger = false; private $debugHandler = false; private $idnaConvert = false; - + // protected - - protected $settings = array(); + + protected $settings = array(); protected $known_vhostfilenames = array(); protected $known_diroptionsfilenames = array(); protected $known_htpasswdsfilenames = array(); protected $virtualhosts_data = array(); protected $diroptions_data = array(); protected $htpasswds_data = array(); - + /** * indicator whether a customer is deactivated or not * if yes, only the webroot will be generated - * + * * @var bool */ private $_deactivated = false; @@ -57,7 +57,7 @@ class apache $this->idnaConvert = $idnaConvert; $this->settings = $settings; } - + protected function getDB() { return $this->db; @@ -75,7 +75,7 @@ class apache $this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading apache'); safe_exec(escapeshellcmd($this->settings['system']['apachereload_command'])); } - + /** * define a standard -statement, bug #32 */ @@ -99,7 +99,7 @@ class apache fwrite($this->debugHandler, ' apache::_createStandardDirectoryEntry: unlinking ' . basename($vhosts_filename) . "\n"); $this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . basename($vhosts_filename)); unlink(makeCorrectFile($vhosts_filename)); - } + } } else { @@ -133,14 +133,14 @@ class apache } else { $vhosts_folder = makeCorrectDir(dirname($this->settings['system']['apacheconf_vhost'])); } - + $vhosts_filename = makeCorrectFile($vhosts_folder . '/05_froxlor_default_errorhandler.conf'); if(!isset($this->virtualhosts_data[$vhosts_filename])) { $this->virtualhosts_data[$vhosts_filename] = ''; } - + if($this->settings['defaultwebsrverrhandler']['err401'] != '') { $this->virtualhosts_data[$vhosts_filename].= 'ErrorDocument 401 ' . $this->settings['defaultwebsrverrhandler']['err401'] . "\n"; @@ -155,7 +155,7 @@ class apache { $this->virtualhosts_data[$vhosts_filename].= 'ErrorDocument 404 ' . $this->settings['defaultwebsrverrhandler']['err404'] . "\n"; } - + if($this->settings['defaultwebsrverrhandler']['err500'] != '') { $this->virtualhosts_data[$vhosts_filename].= 'ErrorDocument 500 ' . $this->settings['defaultwebsrverrhandler']['err500'] . "\n"; @@ -213,7 +213,7 @@ class apache { $mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); } - else + else { $mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__))))); } @@ -225,7 +225,7 @@ class apache } $this->virtualhosts_data[$vhosts_filename].= 'DocumentRoot "'.$mypath.'"'."\n"; - + if($row_ipsandports['vhostcontainer_servername_statement'] == '1') { $this->virtualhosts_data[$vhosts_filename].= ' ServerName ' . $this->settings['system']['hostname'] . "\n"; @@ -236,7 +236,7 @@ class apache && $this->settings['system']['mod_fcgid'] == '1' ) { - + $configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/' . $this->settings['system']['hostname']); $this->virtualhosts_data[$vhosts_filename].= ' FcgidIdleTimeout ' . $this->settings['system']['mod_fcgid_idle_timeout'] . "\n"; if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0) @@ -271,12 +271,12 @@ class apache 'safemode' => '0', 'email' => $this->settings['panel']['adminmail'], 'loginname' => 'froxlor.panel', - 'documentroot' => $mypath + 'documentroot' => $mypath, ); $php = new phpinterface($this->getDB(), $this->settings, $domain); $this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n"; - $this->virtualhosts_data[$vhosts_filename].= ' FastCgiExternalServer ' . $mypath . $domain['domain'] . "." . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $this->settings['system']['mod_fcgid_httpuser'] . ' -group ' . $this->settings['system']['mod_fcgid_httpuser'] . " -idle-timeout " . $this->settings['phpfpm']['idle_timeout'] . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $this->settings['system']['mod_fcgid_httpuser'] . ' -group ' . $this->settings['system']['mod_fcgid_httpuser'] . " -idle-timeout " . $this->settings['phpfpm']['idle_timeout'] . "\n"; $this->virtualhosts_data[$vhosts_filename].= ' ' . "\n"; $this->virtualhosts_data[$vhosts_filename].= ' AddHandler php5-fastcgi .php'. "\n"; $this->virtualhosts_data[$vhosts_filename].= ' Action php5-fastcgi /fastcgiphp' . "\n"; @@ -284,7 +284,7 @@ class apache $this->virtualhosts_data[$vhosts_filename].= ' Order allow,deny' . "\n"; $this->virtualhosts_data[$vhosts_filename].= ' allow from all' . "\n"; $this->virtualhosts_data[$vhosts_filename].= ' ' . "\n"; - $this->virtualhosts_data[$vhosts_filename].= ' Alias /fastcgiphp ' . $mypath . $domain['domain'] . "." . 'fpm.external' . "\n"; + $this->virtualhosts_data[$vhosts_filename].= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . 'fpm.external' . "\n"; } /** @@ -294,7 +294,7 @@ class apache $this->virtualhosts_data[$vhosts_filename].= "\t\tAllow from all\n"; $this->virtualhosts_data[$vhosts_filename].= "\t\tOptions -Indexes\n"; $this->virtualhosts_data[$vhosts_filename].= "\t\n"; - + $this->virtualhosts_data[$vhosts_filename].= "\t\n"; $this->virtualhosts_data[$vhosts_filename].= "\t\tOrder Deny,Allow\n"; $this->virtualhosts_data[$vhosts_filename].= "\t\tDeny from All\n"; @@ -334,12 +334,12 @@ class apache { $this->virtualhosts_data[$vhosts_filename].= ' SSLEngine On' . "\n"; $this->virtualhosts_data[$vhosts_filename].= ' SSLCertificateFile ' . makeCorrectFile($row_ipsandports['ssl_cert_file']) . "\n"; - + if($row_ipsandports['ssl_key_file'] != '') { $this->virtualhosts_data[$vhosts_filename].= ' SSLCertificateKeyFile ' . makeCorrectFile($row_ipsandports['ssl_key_file']) . "\n"; } - + if($row_ipsandports['ssl_ca_file'] != '') { $this->virtualhosts_data[$vhosts_filename].= ' SSLCACertificateFile ' . makeCorrectFile($row_ipsandports['ssl_ca_file']) . "\n"; @@ -358,7 +358,7 @@ class apache } unset($vhosts_filename); } - + /** * bug #32 */ @@ -392,7 +392,7 @@ class apache { $_phpappendopenbasedir = appendOpenBasedirPath($domain['documentroot'], true); } - + $_custom_openbasedir = explode(':', $this->settings['system']['phpappendopenbasedir']); foreach($_custom_openbasedir as $cobd) { @@ -419,7 +419,7 @@ class apache return $php_options_text; } - + public function createOwnVhostStarter() { } @@ -525,7 +525,7 @@ class apache } else { - $stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']) . '"' . "\n"; + $stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']) . '"' . "\n"; } } else @@ -549,7 +549,7 @@ class apache { $stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '"' . "\n"; $stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n"; - } + } else { $stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer') . '"' . "\n"; @@ -609,13 +609,13 @@ class apache touch($error_log); chown($error_log, $this->settings['system']['httpuser']); chgrp($error_log, $this->settings['system']['httpgroup']); - + $access_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log'); // Create the logfile if it does not exist (fixes #46) touch($access_log); chown($access_log, $this->settings['system']['httpuser']); chgrp($access_log, $this->settings['system']['httpgroup']); - + $logfiles_text.= ' ErrorLog "' . $error_log . "\"\n"; $logfiles_text.= ' CustomLog "' . $access_log .'" combined' . "\n"; @@ -623,19 +623,19 @@ class apache if($this->settings['system']['awstats_enabled'] == '1') { - if((int)$domain['parentdomainid'] == 0) + if((int)$domain['parentdomainid'] == 0) { // prepare the aliases and subdomains for stats config files $server_alias = ''; - $alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` + $alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . $domain['id'] . '\' OR `parentdomainid` =\''. $domain['id']. '\''); - + while(($alias_domain = $this->db->fetch_array($alias_domains)) !== false) { $server_alias.= ' ' . $alias_domain['domain'] . ' '; - + if($alias_domain['iswildcarddomain'] == '1') { $server_alias.= '*.' . $alias_domain['domain']; @@ -652,7 +652,7 @@ class apache } } } - + if($domain['iswildcarddomain'] == '1') { $alias = '*.' . $domain['domain']; @@ -668,8 +668,8 @@ class apache $alias = ''; } } - - // After inserting the AWStats information, + + // After inserting the AWStats information, // be sure to build the awstats conf file as well // and chown it using $awstats_params, #258 // Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations @@ -686,14 +686,14 @@ class apache protected function getVhostFilename($domain, $ssl_vhost = false) { - if((int)$domain['parentdomainid'] == 0 + if((int)$domain['parentdomainid'] == 0 && isCustomerStdSubdomain((int)$domain['id']) == false && ((int)$domain['ismainbutsubto'] == 0 || domainMainToSubExists($domain['ismainbutsubto']) == false) ) { $vhost_no = '22'; } - elseif((int)$domain['parentdomainid'] == 0 + elseif((int)$domain['parentdomainid'] == 0 && isCustomerStdSubdomain((int)$domain['id']) == false && (int)$domain['ismainbutsubto'] > 0 ) { @@ -772,14 +772,14 @@ class apache if(substr($corrected_docroot, -1) == '/') { $corrected_docroot = substr($corrected_docroot, 0, -1); } - + /* Get domain's redirect code */ $code = getDomainRedirectCode($domain['id']); $modrew_red = ''; if ($code != '') { $modrew_red = '[R='. $code . ';L]'; - } - + } + // redirect everything, not only root-directory, #541 $vhost_content.= ' '."\n"; $vhost_content.= ' RewriteEngine On' . "\n"; @@ -1308,10 +1308,10 @@ class apache foreach($this->known_vhostfilenames as $vhostfilename){ $known_phpfpm_files[]=preg_replace('/^(05|10|20|21|22|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_/', '', $vhostfilename); } - + $configdir = $this->settings['phpfpm']['configdir']; $phpfpm_file_dirhandle = opendir($this->settings['phpfpm']['configdir']); - + while(false !== ($phpfpm_filename = readdir($phpfpm_file_dirhandle))) { if($phpfpm_filename != '.' @@ -1364,10 +1364,10 @@ class apache foreach($this->known_vhostfilenames as $vhostfilename){ $known_phpfpm_files[]=preg_replace('/^(05|10|20|21|22|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_/', '', $vhostfilename); } - + $configdir = $this->settings['phpfpm']['configdir']; $phpfpm_file_dirhandle = opendir($this->settings['phpfpm']['configdir']); - + while(false !== ($phpfpm_filename = readdir($phpfpm_file_dirhandle))) { if(is_array($known_phpfpm_files) @@ -1404,7 +1404,7 @@ class apache while(false !== ($htpasswd_filename = readdir($htpasswds_file_dirhandle))) { if($htpasswd_filename != '.' - && $htpasswd_filename != '..' + && $htpasswd_filename != '..' && !in_array($htpasswd_filename, $this->known_htpasswdsfilenames) && file_exists(makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $htpasswd_filename))) { 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 caa07c1e..f9e37a20 100644 --- a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php +++ b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php @@ -38,7 +38,7 @@ class apache_fcgid extends apache if((int)$this->settings['phpfpm']['enabled'] == 1) { $php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n"; - $php_options_text.= ' FastCgiExternalServer ' . makeCorrectDir($domain['documentroot']) . $domain['domain'] . "." . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $domain['loginname'] . ' -group ' . $domain['loginname'] . " -idle-timeout " . $this->settings['phpfpm']['idle_timeout'] . "\n"; + $php_options_text.= ' FastCgiExternalServer ' . makeCorrectDir($php->getInterface()->getAliasConfigDir()) . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $domain['loginname'] . ' -group ' . $domain['loginname'] . " -idle-timeout " . $this->settings['phpfpm']['idle_timeout'] . "\n"; $php_options_text.= ' ' . "\n"; $php_options_text.= ' ' . "\n"; $php_options_text.= ' SetHandler php5-fastcgi'. "\n"; @@ -48,7 +48,7 @@ class apache_fcgid extends apache $php_options_text.= ' Order allow,deny' . "\n"; $php_options_text.= ' allow from all' . "\n"; $php_options_text.= ' ' . "\n"; - $php_options_text.= ' Alias /fastcgiphp ' . makeCorrectDir($domain['documentroot']) . $domain['domain'] . "." . 'fpm.external' . "\n"; + $php_options_text.= ' Alias /fastcgiphp ' . makeCorrectDir($php->getInterface()->getAliasConfigDir()) . 'fpm.external' . "\n"; } else { @@ -79,8 +79,8 @@ class apache_fcgid extends apache // create starter-file | config-file $php->getInterface()->createConfig($phpconfig); - - // create php.ini + + // create php.ini // @TODO make php-fpm support this $php->getInterface()->createIniFile($phpconfig); } @@ -109,7 +109,7 @@ class apache_fcgid extends apache && $this->settings['phpfpm']['enabled_ownvhost'] == '1' ) { $user = $this->settings['phpfpm']['vhost_httpuser']; - $group = $this->settings['phpfpm']['vhost_httpgroup']; + $group = $this->settings['phpfpm']['vhost_httpgroup']; } $domain = array( @@ -129,7 +129,7 @@ class apache_fcgid extends apache // 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)); - + // get php.ini for our own vhost $php = new phpinterface($this->getDB(), $this->settings, $domain); @@ -138,8 +138,8 @@ class apache_fcgid extends apache // create starter-file | config-file $php->getInterface()->createConfig($phpconfig); - - // create php.ini + + // create php.ini // @TODO make php-fpm support this $php->getInterface()->createIniFile($phpconfig); }