diff --git a/lib/classes/phpinterface/class.phpinterface_fpm.php b/lib/classes/phpinterface/class.phpinterface_fpm.php
index aceef322..53a28be8 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,32 @@ 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['system']['phpfpm_aliasconfigdir'])) {
+ $this->_settings['system']['phpfpm_aliasconfigdir'] = '/var/www/php-fpm';
+ }
+
+ $configdir = makeCorrectDir($this->_settings['system']['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/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php
index a86d1c42..63ca8091 100644
--- a/scripts/jobs/cron_tasks.inc.http.10.apache.php
+++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php
@@ -276,7 +276,7 @@ class apache
$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 ' . $php->getInterface()->getTempDir() . $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 ' . $php->getInterface()->getTempDir() . $domain['domain'] . "." . 'fpm.external' . "\n";
+ $this->virtualhosts_data[$vhosts_filename].= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . 'fpm.external' . "\n";
}
/**
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 215a266b..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($php->getInterface()->getTempDir()) . $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($php->getInterface()->getTempDir()) . $domain['domain'] . "." . 'fpm.external' . "\n";
+ $php_options_text.= ' Alias /fastcgiphp ' . makeCorrectDir($php->getInterface()->getAliasConfigDir()) . 'fpm.external' . "\n";
}
else
{