migrate phpinterface-classes to PDO database class, refs #1287
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -19,13 +19,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class phpinterface
|
class phpinterface {
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Database handler
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
private $_db = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings array
|
* Settings array
|
||||||
@@ -54,9 +48,7 @@ class phpinterface
|
|||||||
/**
|
/**
|
||||||
* main constructor
|
* main constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($db, $settings, $domain)
|
public function __construct($settings, $domain) {
|
||||||
{
|
|
||||||
$this->_db = $db;
|
|
||||||
$this->_settings = $settings;
|
$this->_settings = $settings;
|
||||||
$this->_domain = $domain;
|
$this->_domain = $domain;
|
||||||
$this->_setInterface();
|
$this->_setInterface();
|
||||||
@@ -66,8 +58,7 @@ class phpinterface
|
|||||||
* returns the interface-object
|
* returns the interface-object
|
||||||
* from where we can control it
|
* from where we can control it
|
||||||
*/
|
*/
|
||||||
public function getInterface()
|
public function getInterface() {
|
||||||
{
|
|
||||||
return $this->_interface;
|
return $this->_interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,16 +67,13 @@ class phpinterface
|
|||||||
* php-interface: fcgid or php-fpm
|
* php-interface: fcgid or php-fpm
|
||||||
* sets private $_interface variable
|
* sets private $_interface variable
|
||||||
*/
|
*/
|
||||||
private function _setInterface()
|
private function _setInterface() {
|
||||||
{
|
|
||||||
// php-fpm
|
// php-fpm
|
||||||
if((int)$this->_settings['phpfpm']['enabled'] == 1)
|
if ((int)$this->_settings['phpfpm']['enabled'] == 1) {
|
||||||
{
|
$this->_interface = new phpinterface_fpm($this->_settings, $this->_domain);
|
||||||
$this->_interface = new phpinterface_fpm($this->_db, $this->_settings, $this->_domain);
|
|
||||||
}
|
} elseif ((int)$this->_settings['system']['mod_fcgid'] == 1) {
|
||||||
elseif((int)$this->_settings['system']['mod_fcgid'] == 1)
|
$this->_interface = new phpinterface_fcgid($this->_settings, $this->_domain);
|
||||||
{
|
|
||||||
$this->_interface = new phpinterface_fcgid($this->_db, $this->_settings, $this->_domain);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,23 +84,21 @@ class phpinterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getPhpConfig($php_config_id)
|
public function getPhpConfig($php_config_id) {
|
||||||
{
|
|
||||||
$php_config_id = intval($php_config_id);
|
$php_config_id = intval($php_config_id);
|
||||||
|
|
||||||
// If domain has no config, we will use the default one.
|
// If domain has no config, we will use the default one.
|
||||||
|
if ($php_config_id == 0) {
|
||||||
if($php_config_id == 0)
|
|
||||||
{
|
|
||||||
$php_config_id = 1;
|
$php_config_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($this->php_configs_cache[$php_config_id]))
|
if (!isset($this->php_configs_cache[$php_config_id])) {
|
||||||
{
|
$stmt = Database::prepare("
|
||||||
$this->_php_configs_cache[$php_config_id] = $this->_db->query_first(
|
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
|
||||||
"SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`
|
|
||||||
WHERE `id` = " . (int)$php_config_id
|
|
||||||
);
|
);
|
||||||
|
Database::pexecute($stmt, array('id' => $php_config_id));
|
||||||
|
$this->_php_configs_cache[$php_config_id] = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_php_configs_cache[$php_config_id];
|
return $this->_php_configs_cache[$php_config_id];
|
||||||
|
|||||||
@@ -19,13 +19,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class phpinterface_fcgid
|
class phpinterface_fcgid {
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Database handler
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
private $_db = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings array
|
* Settings array
|
||||||
@@ -48,15 +42,13 @@ class phpinterface_fcgid
|
|||||||
/**
|
/**
|
||||||
* main constructor
|
* main constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($db, $settings, $domain)
|
public function __construct($settings, $domain) {
|
||||||
{
|
|
||||||
$this->_db = $db;
|
|
||||||
$this->_settings = $settings;
|
$this->_settings = $settings;
|
||||||
$this->_domain = $domain;
|
$this->_domain = $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createConfig($phpconfig)
|
public function createConfig($phpconfig) {
|
||||||
{
|
|
||||||
// create starter
|
// create starter
|
||||||
$starter_file = "#!/bin/sh\n\n";
|
$starter_file = "#!/bin/sh\n\n";
|
||||||
$starter_file.= "#\n";
|
$starter_file.= "#\n";
|
||||||
@@ -68,18 +60,13 @@ class phpinterface_fcgid
|
|||||||
$starter_file.= "export PHPRC\n";
|
$starter_file.= "export PHPRC\n";
|
||||||
|
|
||||||
// set number of processes for one domain
|
// set number of processes for one domain
|
||||||
if((int)$this->_domain['mod_fcgid_starter'] != - 1)
|
if ((int)$this->_domain['mod_fcgid_starter'] != - 1) {
|
||||||
{
|
|
||||||
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_domain['mod_fcgid_starter'] . "\n";
|
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_domain['mod_fcgid_starter'] . "\n";
|
||||||
}
|
|
||||||
else
|
} else {
|
||||||
{
|
if ((int)$phpconfig['mod_fcgid_starter'] != - 1) {
|
||||||
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
|
|
||||||
{
|
|
||||||
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
|
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_settings['system']['mod_fcgid_starter'] . "\n";
|
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_settings['system']['mod_fcgid_starter'] . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,18 +74,12 @@ class phpinterface_fcgid
|
|||||||
$starter_file.= "export PHP_FCGI_CHILDREN\n";
|
$starter_file.= "export PHP_FCGI_CHILDREN\n";
|
||||||
|
|
||||||
// set number of maximum requests for one domain
|
// set number of maximum requests for one domain
|
||||||
if((int)$this->_domain['mod_fcgid_maxrequests'] != - 1)
|
if ((int)$this->_domain['mod_fcgid_maxrequests'] != - 1) {
|
||||||
{
|
|
||||||
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_domain['mod_fcgid_maxrequests'] . "\n";
|
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_domain['mod_fcgid_maxrequests'] . "\n";
|
||||||
}
|
} else {
|
||||||
else
|
if ((int)$phpconfig['mod_fcgid_maxrequests'] != - 1) {
|
||||||
{
|
|
||||||
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
|
|
||||||
{
|
|
||||||
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
|
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_settings['system']['mod_fcgid_maxrequests'] . "\n";
|
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_settings['system']['mod_fcgid_maxrequests'] . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,8 +90,7 @@ class phpinterface_fcgid
|
|||||||
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($this->getConfigDir()) . "\n";
|
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($this->getConfigDir()) . "\n";
|
||||||
|
|
||||||
//remove +i attibute, so starter can be overwritten
|
//remove +i attibute, so starter can be overwritten
|
||||||
if(file_exists($this->getStarterFile()))
|
if (file_exists($this->getStarterFile())) {
|
||||||
{
|
|
||||||
removeImmutable($this->getStarterFile());
|
removeImmutable($this->getStarterFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,34 +102,36 @@ class phpinterface_fcgid
|
|||||||
setImmutable($this->getStarterFile());
|
setImmutable($this->getStarterFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createIniFile($phpconfig)
|
/**
|
||||||
{
|
* create customized php.ini
|
||||||
|
*
|
||||||
|
* @param array $phpconfig
|
||||||
|
*/
|
||||||
|
public function createIniFile($phpconfig) {
|
||||||
|
|
||||||
$openbasedir = '';
|
$openbasedir = '';
|
||||||
$openbasedirc = ';';
|
$openbasedirc = ';';
|
||||||
|
|
||||||
if($this->_domain['openbasedir'] == '1')
|
if ($this->_domain['openbasedir'] == '1') {
|
||||||
{
|
|
||||||
$openbasedirc = '';
|
$openbasedirc = '';
|
||||||
$_phpappendopenbasedir = '';
|
$_phpappendopenbasedir = '';
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['system']['mod_fcgid_peardir']);
|
$_custom_openbasedir = explode(':', $this->_settings['system']['mod_fcgid_peardir']);
|
||||||
foreach($_custom_openbasedir as $cobd)
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
{
|
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
|
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
|
||||||
foreach($_custom_openbasedir as $cobd)
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
{
|
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false)
|
if ($this->_domain['openbasedir_path'] == '0'
|
||||||
{
|
&& strstr($this->_domain['documentroot'], ":") === false
|
||||||
|
) {
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
|
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
|
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,17 +140,14 @@ class phpinterface_fcgid
|
|||||||
|
|
||||||
$openbasedir = explode(':', $openbasedir);
|
$openbasedir = explode(':', $openbasedir);
|
||||||
$clean_openbasedir = array();
|
$clean_openbasedir = array();
|
||||||
foreach($openbasedir as $number => $path)
|
foreach ($openbasedir as $number => $path) {
|
||||||
{
|
if (trim($path) != '/') {
|
||||||
if(trim($path) != '/')
|
|
||||||
{
|
|
||||||
$clean_openbasedir[] = makeCorrectDir($path);
|
$clean_openbasedir[] = makeCorrectDir($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$openbasedir = implode(':', $clean_openbasedir);
|
$openbasedir = implode(':', $clean_openbasedir);
|
||||||
}
|
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
$openbasedir = 'none';
|
$openbasedir = 'none';
|
||||||
$openbasedirc = ';';
|
$openbasedirc = ';';
|
||||||
}
|
}
|
||||||
@@ -211,12 +190,11 @@ class phpinterface_fcgid
|
|||||||
*
|
*
|
||||||
* @return string the directory
|
* @return string the directory
|
||||||
*/
|
*/
|
||||||
public function getConfigDir($createifnotexists = true)
|
public function getConfigDir($createifnotexists = true) {
|
||||||
{
|
|
||||||
$configdir = makeCorrectDir($this->_settings['system']['mod_fcgid_configdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
$configdir = makeCorrectDir($this->_settings['system']['mod_fcgid_configdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
||||||
|
|
||||||
if(!is_dir($configdir) && $createifnotexists)
|
if (!is_dir($configdir) && $createifnotexists) {
|
||||||
{
|
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||||
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
||||||
}
|
}
|
||||||
@@ -231,12 +209,11 @@ class phpinterface_fcgid
|
|||||||
*
|
*
|
||||||
* @return string the directory
|
* @return string the directory
|
||||||
*/
|
*/
|
||||||
public function getTempDir($createifnotexists = true)
|
public function getTempDir($createifnotexists = true) {
|
||||||
{
|
|
||||||
$tmpdir = makeCorrectDir($this->_settings['system']['mod_fcgid_tmpdir'] . '/' . $this->_domain['loginname'] . '/');
|
$tmpdir = makeCorrectDir($this->_settings['system']['mod_fcgid_tmpdir'] . '/' . $this->_domain['loginname'] . '/');
|
||||||
|
|
||||||
if(!is_dir($tmpdir) && $createifnotexists)
|
if (!is_dir($tmpdir) && $createifnotexists) {
|
||||||
{
|
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
||||||
safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir));
|
safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir));
|
||||||
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
|
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
|
||||||
@@ -250,8 +227,7 @@ class phpinterface_fcgid
|
|||||||
*
|
*
|
||||||
* @return string the directory
|
* @return string the directory
|
||||||
*/
|
*/
|
||||||
public function getStarterFile()
|
public function getStarterFile() {
|
||||||
{
|
|
||||||
$starter_filename = makeCorrectFile($this->getConfigDir() . '/php-fcgi-starter');
|
$starter_filename = makeCorrectFile($this->getConfigDir() . '/php-fcgi-starter');
|
||||||
return $starter_filename;
|
return $starter_filename;
|
||||||
}
|
}
|
||||||
@@ -261,8 +237,7 @@ class phpinterface_fcgid
|
|||||||
*
|
*
|
||||||
* @return string full with path file-name
|
* @return string full with path file-name
|
||||||
*/
|
*/
|
||||||
public function getIniFile()
|
public function getIniFile() {
|
||||||
{
|
|
||||||
$phpini_filename = makeCorrectFile($this->getConfigDir() . '/php.ini');
|
$phpini_filename = makeCorrectFile($this->getConfigDir() . '/php.ini');
|
||||||
return $phpini_filename;
|
return $phpini_filename;
|
||||||
}
|
}
|
||||||
@@ -274,18 +249,17 @@ class phpinterface_fcgid
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _getAdminData($adminid)
|
private function _getAdminData($adminid) {
|
||||||
{
|
|
||||||
$adminid = intval($adminid);
|
$adminid = intval($adminid);
|
||||||
|
|
||||||
if(!isset($this->_admin_cache[$adminid]))
|
if (!isset($this->_admin_cache[$adminid])) {
|
||||||
{
|
$stmt = Database::prepare("TABLE_PANEL_ADMINS
|
||||||
$this->_admin_cache[$adminid] = $this->_db->query_first(
|
SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :id"
|
||||||
"SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
|
|
||||||
WHERE `adminid` = " . (int)$adminid
|
|
||||||
);
|
);
|
||||||
|
Database::pexecute($stmt, array('id' => $adminid));
|
||||||
|
$this->_admin_cache[$adminid] = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_admin_cache[$adminid];
|
return $this->_admin_cache[$adminid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class phpinterface_fpm
|
class phpinterface_fpm {
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Database handler
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
private $_db = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings array
|
* Settings array
|
||||||
@@ -98,18 +92,21 @@ class phpinterface_fpm
|
|||||||
/**
|
/**
|
||||||
* main constructor
|
* main constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($db, $settings, $domain)
|
public function __construct($settings, $domain) {
|
||||||
{
|
|
||||||
$this->_db = $db;
|
|
||||||
$this->_settings = $settings;
|
$this->_settings = $settings;
|
||||||
$this->_domain = $domain;
|
$this->_domain = $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createConfig($phpconfig)
|
/**
|
||||||
{
|
* create fpm-pool config
|
||||||
|
*
|
||||||
|
* @param array $phpconfig
|
||||||
|
*/
|
||||||
|
public function createConfig($phpconfig) {
|
||||||
|
|
||||||
$fh = @fopen($this->getConfigFile(), 'w');
|
$fh = @fopen($this->getConfigFile(), 'w');
|
||||||
if($fh)
|
|
||||||
{
|
if ($fh) {
|
||||||
$fpm_pm = $this->_settings['phpfpm']['pm'];
|
$fpm_pm = $this->_settings['phpfpm']['pm'];
|
||||||
$fpm_children = (int)$this->_settings['phpfpm']['max_children'];
|
$fpm_children = (int)$this->_settings['phpfpm']['max_children'];
|
||||||
$fpm_start_servers = (int)$this->_settings['phpfpm']['start_servers'];
|
$fpm_start_servers = (int)$this->_settings['phpfpm']['start_servers'];
|
||||||
@@ -125,31 +122,26 @@ class phpinterface_fpm
|
|||||||
$fpm_config = ';PHP-FPM configuration for "'.$this->_domain['domain'].'" created on ' . date("Y.m.d H:i:s") . "\n";
|
$fpm_config = ';PHP-FPM configuration for "'.$this->_domain['domain'].'" created on ' . date("Y.m.d H:i:s") . "\n";
|
||||||
$fpm_config.= '['.$this->_domain['domain'].']'."\n";
|
$fpm_config.= '['.$this->_domain['domain'].']'."\n";
|
||||||
$fpm_config.= 'listen = '.$this->getSocketFile()."\n";
|
$fpm_config.= 'listen = '.$this->getSocketFile()."\n";
|
||||||
if($this->_domain['loginname'] == 'froxlor.panel')
|
if ($this->_domain['loginname'] == 'froxlor.panel') {
|
||||||
{
|
|
||||||
$fpm_config.= 'listen.owner = '.$this->_domain['guid']."\n";
|
$fpm_config.= 'listen.owner = '.$this->_domain['guid']."\n";
|
||||||
$fpm_config.= 'listen.group = '.$this->_domain['guid']."\n";
|
$fpm_config.= 'listen.group = '.$this->_domain['guid']."\n";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$fpm_config.= 'listen.owner = '.$this->_domain['loginname']."\n";
|
$fpm_config.= 'listen.owner = '.$this->_domain['loginname']."\n";
|
||||||
$fpm_config.= 'listen.group = '.$this->_domain['loginname']."\n";
|
$fpm_config.= 'listen.group = '.$this->_domain['loginname']."\n";
|
||||||
}
|
}
|
||||||
$fpm_config.= 'listen.mode = 0666'."\n";
|
$fpm_config.= 'listen.mode = 0666'."\n";
|
||||||
|
|
||||||
if($this->_domain['loginname'] == 'froxlor.panel')
|
if ($this->_domain['loginname'] == 'froxlor.panel') {
|
||||||
{
|
|
||||||
$fpm_config.= 'user = '.$this->_domain['guid']."\n";
|
$fpm_config.= 'user = '.$this->_domain['guid']."\n";
|
||||||
$fpm_config.= 'group = '.$this->_domain['guid']."\n";
|
$fpm_config.= 'group = '.$this->_domain['guid']."\n";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$fpm_config.= 'user = '.$this->_domain['loginname']."\n";
|
$fpm_config.= 'user = '.$this->_domain['loginname']."\n";
|
||||||
$fpm_config.= 'group = '.$this->_domain['loginname']."\n";
|
$fpm_config.= 'group = '.$this->_domain['loginname']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$fpm_config.= 'pm = '.$fpm_pm."\n";
|
$fpm_config.= 'pm = '.$fpm_pm."\n";
|
||||||
$fpm_config.= 'pm.max_children = '.$fpm_children."\n";
|
$fpm_config.= 'pm.max_children = '.$fpm_children."\n";
|
||||||
|
|
||||||
if ($fpm_pm == 'dynamic') {
|
if ($fpm_pm == 'dynamic') {
|
||||||
// failsafe, refs #955
|
// failsafe, refs #955
|
||||||
if ($fpm_start_servers < $fpm_min_spare_servers) {
|
if ($fpm_start_servers < $fpm_min_spare_servers) {
|
||||||
@@ -167,12 +159,10 @@ class phpinterface_fpm
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fpm_config.= 'pm.max_requests = '.$fpm_requests."\n";
|
$fpm_config.= 'pm.max_requests = '.$fpm_requests."\n";
|
||||||
|
|
||||||
$fpm_config.= ';chroot = '.makeCorrectDir($this->_domain['documentroot'])."\n";
|
$fpm_config.= ';chroot = '.makeCorrectDir($this->_domain['documentroot'])."\n";
|
||||||
|
|
||||||
$tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/');
|
$tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/');
|
||||||
if(!is_dir($tmpdir))
|
if (!is_dir($tmpdir)) {
|
||||||
{
|
|
||||||
$this->getTempDir();
|
$this->getTempDir();
|
||||||
}
|
}
|
||||||
//$slowlog = makeCorrectFile($this->_settings['system']['logfiles_directory'] . $this->_domain['loginname'] . '/php-fpm_slow.log');
|
//$slowlog = makeCorrectFile($this->_settings['system']['logfiles_directory'] . $this->_domain['loginname'] . '/php-fpm_slow.log');
|
||||||
@@ -182,30 +172,26 @@ class phpinterface_fpm
|
|||||||
$fpm_config.= 'env[TEMP] = '.$tmpdir."\n";
|
$fpm_config.= 'env[TEMP] = '.$tmpdir."\n";
|
||||||
|
|
||||||
$fpm_config.= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f '.$this->_domain['email']."\n";
|
$fpm_config.= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f '.$this->_domain['email']."\n";
|
||||||
if($this->_domain['loginname'] != 'froxlor.panel')
|
|
||||||
{
|
if ($this->_domain['loginname'] != 'froxlor.panel') {
|
||||||
if($this->_domain['openbasedir'] == '1')
|
if ($this->_domain['openbasedir'] == '1') {
|
||||||
{
|
|
||||||
$openbasedir = '';
|
$openbasedir = '';
|
||||||
$_phpappendopenbasedir = '';
|
$_phpappendopenbasedir = '';
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['phpfpm']['peardir']);
|
$_custom_openbasedir = explode(':', $this->_settings['phpfpm']['peardir']);
|
||||||
foreach($_custom_openbasedir as $cobd)
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
{
|
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
|
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
|
||||||
foreach($_custom_openbasedir as $cobd)
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
{
|
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false)
|
if ($this->_domain['openbasedir_path'] == '0'
|
||||||
{
|
&& strstr($this->_domain['documentroot'], ":") === false
|
||||||
|
) {
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
|
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
|
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,10 +200,8 @@ class phpinterface_fpm
|
|||||||
|
|
||||||
$openbasedir = explode(':', $openbasedir);
|
$openbasedir = explode(':', $openbasedir);
|
||||||
$clean_openbasedir = array();
|
$clean_openbasedir = array();
|
||||||
foreach($openbasedir as $number => $path)
|
foreach ($openbasedir as $number => $path) {
|
||||||
{
|
if (trim($path) != '/') {
|
||||||
if(trim($path) != '/')
|
|
||||||
{
|
|
||||||
$clean_openbasedir[] = makeCorrectDir($path);
|
$clean_openbasedir[] = makeCorrectDir($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,6 +214,7 @@ class phpinterface_fpm
|
|||||||
$fpm_config.= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n";
|
$fpm_config.= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||||
|
|
||||||
$admin = $this->_getAdminData($this->_domain['adminid']);
|
$admin = $this->_getAdminData($this->_domain['adminid']);
|
||||||
|
|
||||||
$php_ini_variables = array(
|
$php_ini_variables = array(
|
||||||
'SAFE_MODE' => 'Off', // keep this for compatibility, just in case
|
'SAFE_MODE' => 'Off', // keep this for compatibility, just in case
|
||||||
'PEAR_DIR' => $this->_settings['system']['mod_fcgid_peardir'],
|
'PEAR_DIR' => $this->_settings['system']['mod_fcgid_peardir'],
|
||||||
@@ -265,8 +250,7 @@ class phpinterface_fpm
|
|||||||
*
|
*
|
||||||
* @param string $phpconfig
|
* @param string $phpconfig
|
||||||
*/
|
*/
|
||||||
public function createIniFile($phpconfig)
|
public function createIniFile($phpconfig) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,13 +261,12 @@ class phpinterface_fpm
|
|||||||
*
|
*
|
||||||
* @return string the full path to the file
|
* @return string the full path to the file
|
||||||
*/
|
*/
|
||||||
public function getConfigFile($createifnotexists = true)
|
public function getConfigFile($createifnotexists = true) {
|
||||||
{
|
|
||||||
$configdir = makeCorrectDir($this->_settings['phpfpm']['configdir']);
|
$configdir = makeCorrectDir($this->_settings['phpfpm']['configdir']);
|
||||||
$config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf');
|
$config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf');
|
||||||
|
|
||||||
if(!is_dir($configdir) && $createifnotexists)
|
if (!is_dir($configdir) && $createifnotexists) {
|
||||||
{
|
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,13 +280,12 @@ class phpinterface_fpm
|
|||||||
*
|
*
|
||||||
* @return string the full path to the socket
|
* @return string the full path to the socket
|
||||||
*/
|
*/
|
||||||
public function getSocketFile($createifnotexists = true)
|
public function getSocketFile($createifnotexists = true) {
|
||||||
{
|
|
||||||
$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/');
|
$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/');
|
||||||
$socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket');
|
$socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket');
|
||||||
|
|
||||||
if(!is_dir($socketdir) && $createifnotexists)
|
if (!is_dir($socketdir) && $createifnotexists) {
|
||||||
{
|
|
||||||
safe_exec('mkdir -p '.escapeshellarg($socketdir));
|
safe_exec('mkdir -p '.escapeshellarg($socketdir));
|
||||||
safe_exec('chown -R '.$this->_settings['system']['httpuser'].':'.$this->_settings['system']['httpgroup'].' '.escapeshellarg($socketdir));
|
safe_exec('chown -R '.$this->_settings['system']['httpuser'].':'.$this->_settings['system']['httpgroup'].' '.escapeshellarg($socketdir));
|
||||||
}
|
}
|
||||||
@@ -318,12 +300,11 @@ class phpinterface_fpm
|
|||||||
*
|
*
|
||||||
* @return string the directory
|
* @return string the directory
|
||||||
*/
|
*/
|
||||||
public function getTempDir($createifnotexists = true)
|
public function getTempDir($createifnotexists = true) {
|
||||||
{
|
|
||||||
$tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/');
|
$tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/');
|
||||||
|
|
||||||
if(!is_dir($tmpdir) && $createifnotexists)
|
if (!is_dir($tmpdir) && $createifnotexists) {
|
||||||
{
|
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
||||||
safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir));
|
safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir));
|
||||||
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
|
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
|
||||||
@@ -339,16 +320,15 @@ class phpinterface_fpm
|
|||||||
*
|
*
|
||||||
* @return string the directory
|
* @return string the directory
|
||||||
*/
|
*/
|
||||||
public function getAliasConfigDir($createifnotexists = true)
|
public function getAliasConfigDir($createifnotexists = true) {
|
||||||
{
|
|
||||||
// ensure default...
|
// ensure default...
|
||||||
if (!isset($this->_settings['phpfpm']['aliasconfigdir'])) {
|
if (!isset($this->_settings['phpfpm']['aliasconfigdir'])) {
|
||||||
$this->_settings['phpfpm']['aliasconfigdir'] = '/var/www/php-fpm';
|
$this->_settings['phpfpm']['aliasconfigdir'] = '/var/www/php-fpm';
|
||||||
}
|
}
|
||||||
|
|
||||||
$configdir = makeCorrectDir($this->_settings['phpfpm']['aliasconfigdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
$configdir = makeCorrectDir($this->_settings['phpfpm']['aliasconfigdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
||||||
if(!is_dir($configdir) && $createifnotexists)
|
if (!is_dir($configdir) && $createifnotexists) {
|
||||||
{
|
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||||
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
||||||
}
|
}
|
||||||
@@ -364,15 +344,16 @@ class phpinterface_fpm
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _getAdminData($adminid) {
|
private function _getAdminData($adminid) {
|
||||||
|
|
||||||
$adminid = intval($adminid);
|
$adminid = intval($adminid);
|
||||||
|
|
||||||
if (!isset($this->_admin_cache[$adminid])) {
|
if (!isset($this->_admin_cache[$adminid])) {
|
||||||
$this->_admin_cache[$adminid] = $this->_db->query_first(
|
$stmt = Database::prepare("TABLE_PANEL_ADMINS
|
||||||
"SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
|
SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :id"
|
||||||
WHERE `adminid` = " . (int)$adminid
|
|
||||||
);
|
);
|
||||||
|
Database::pexecute($stmt, array('id' => $adminid));
|
||||||
|
$this->_admin_cache[$adminid] = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_admin_cache[$adminid];
|
return $this->_admin_cache[$adminid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class apache
|
|||||||
'loginname' => 'froxlor.panel',
|
'loginname' => 'froxlor.panel',
|
||||||
'documentroot' => $mypath
|
'documentroot' => $mypath
|
||||||
);
|
);
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||||
|
|
||||||
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
|
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
|
||||||
@@ -273,7 +273,7 @@ class apache
|
|||||||
'documentroot' => $mypath,
|
'documentroot' => $mypath,
|
||||||
);
|
);
|
||||||
|
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
$phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']);
|
$phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']);
|
||||||
$srvName = substr(md5($ipport),0,4).'.fpm.external';
|
$srvName = substr(md5($ipport),0,4).'.fpm.external';
|
||||||
if ($row_ipsandports['ssl']) {
|
if ($row_ipsandports['ssl']) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class apache_fcgid extends apache
|
|||||||
|
|
||||||
if($domain['phpenabled'] == '1')
|
if($domain['phpenabled'] == '1')
|
||||||
{
|
{
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
||||||
|
|
||||||
if((int)$this->settings['phpfpm']['enabled'] == 1)
|
if((int)$this->settings['phpfpm']['enabled'] == 1)
|
||||||
@@ -93,8 +93,8 @@ class apache_fcgid extends apache
|
|||||||
// create starter-file | config-file
|
// create starter-file | config-file
|
||||||
$php->getInterface()->createConfig($phpconfig);
|
$php->getInterface()->createConfig($phpconfig);
|
||||||
|
|
||||||
// create php.ini
|
// create php.ini (fpm does nothing here, as it
|
||||||
// @TODO make php-fpm support this
|
// defines ini-settings in its pool config)
|
||||||
$php->getInterface()->createIniFile($phpconfig);
|
$php->getInterface()->createIniFile($phpconfig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -143,7 +143,7 @@ class apache_fcgid extends apache
|
|||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
||||||
|
|
||||||
// get php.ini for our own vhost
|
// get php.ini for our own vhost
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
|
|
||||||
// get php-config
|
// get php-config
|
||||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||||
@@ -157,8 +157,8 @@ class apache_fcgid extends apache
|
|||||||
// create starter-file | config-file
|
// create starter-file | config-file
|
||||||
$php->getInterface()->createConfig($phpconfig);
|
$php->getInterface()->createConfig($phpconfig);
|
||||||
|
|
||||||
// create php.ini
|
// create php.ini (fpm does nothing here, as it
|
||||||
// @TODO make php-fpm support this
|
// defines ini-settings in its pool config)
|
||||||
$php->getInterface()->createIniFile($phpconfig);
|
$php->getInterface()->createIniFile($phpconfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class lighttpd
|
|||||||
'documentroot' => $mypath
|
'documentroot' => $mypath
|
||||||
);
|
);
|
||||||
|
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
|
|
||||||
$this->lighttpd_data[$vhost_filename].= ' fastcgi.server = ( '."\n";
|
$this->lighttpd_data[$vhost_filename].= ' fastcgi.server = ( '."\n";
|
||||||
$this->lighttpd_data[$vhost_filename].= "\t".'".php" => ('."\n";
|
$this->lighttpd_data[$vhost_filename].= "\t".'".php" => ('."\n";
|
||||||
|
|||||||
@@ -15,10 +15,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This script creates the php.ini's used by mod_suPHP+php-cgi
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(@php_sapi_name() != 'cli'
|
if(@php_sapi_name() != 'cli'
|
||||||
&& @php_sapi_name() != 'cgi'
|
&& @php_sapi_name() != 'cgi'
|
||||||
&& @php_sapi_name() != 'cgi-fcgi')
|
&& @php_sapi_name() != 'cgi-fcgi')
|
||||||
@@ -34,7 +30,7 @@ class lighttpd_fcgid extends lighttpd
|
|||||||
|
|
||||||
if($domain['phpenabled'] == '1')
|
if($domain['phpenabled'] == '1')
|
||||||
{
|
{
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
||||||
|
|
||||||
// vhost data for php-fpm
|
// vhost data for php-fpm
|
||||||
@@ -105,8 +101,8 @@ class lighttpd_fcgid extends lighttpd
|
|||||||
// create starter-file | config-file
|
// create starter-file | config-file
|
||||||
$php->getInterface()->createConfig($phpconfig);
|
$php->getInterface()->createConfig($phpconfig);
|
||||||
|
|
||||||
// create php.ini
|
// create php.ini (fpm does nothing here, as it
|
||||||
// @TODO make php-fpm support this
|
// defines ini-settings in its pool config)
|
||||||
$php->getInterface()->createIniFile($phpconfig);
|
$php->getInterface()->createIniFile($phpconfig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -145,7 +141,7 @@ class lighttpd_fcgid extends lighttpd
|
|||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
||||||
|
|
||||||
// get php.ini for our own vhost
|
// get php.ini for our own vhost
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
|
|
||||||
// get php-config
|
// get php-config
|
||||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||||
@@ -159,8 +155,8 @@ class lighttpd_fcgid extends lighttpd
|
|||||||
// create starter-file | config-file
|
// create starter-file | config-file
|
||||||
$php->getInterface()->createConfig($phpconfig);
|
$php->getInterface()->createConfig($phpconfig);
|
||||||
|
|
||||||
// create php.ini
|
// create php.ini (fpm does nothing here, as it
|
||||||
// @TODO make php-fpm support this
|
// defines ini-settings in its pool config)
|
||||||
$php->getInterface()->createIniFile($phpconfig);
|
$php->getInterface()->createIniFile($phpconfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ class nginx
|
|||||||
'documentroot' => $mypath,
|
'documentroot' => $mypath,
|
||||||
);
|
);
|
||||||
|
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
$this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n";
|
$this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n";
|
||||||
} else {
|
} else {
|
||||||
$this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
|
$this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
|
||||||
|
|||||||
@@ -15,10 +15,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This script creates the php.ini's used by mod_suPHP+php-cgi
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(@php_sapi_name() != 'cli'
|
if(@php_sapi_name() != 'cli'
|
||||||
&& @php_sapi_name() != 'cgi'
|
&& @php_sapi_name() != 'cgi'
|
||||||
&& @php_sapi_name() != 'cgi-fcgi')
|
&& @php_sapi_name() != 'cgi-fcgi')
|
||||||
@@ -34,7 +30,7 @@ class nginx_phpfpm extends nginx
|
|||||||
|
|
||||||
if($domain['phpenabled'] == '1')
|
if($domain['phpenabled'] == '1')
|
||||||
{
|
{
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
||||||
|
|
||||||
$php_options_text = "\t".'location ~ \.php$ {'."\n";
|
$php_options_text = "\t".'location ~ \.php$ {'."\n";
|
||||||
@@ -52,8 +48,8 @@ class nginx_phpfpm extends nginx
|
|||||||
// create starter-file | config-file
|
// create starter-file | config-file
|
||||||
$php->getInterface()->createConfig($phpconfig);
|
$php->getInterface()->createConfig($phpconfig);
|
||||||
|
|
||||||
// create php.ini
|
// create php.ini (fpm does nothing here, as it
|
||||||
// @TODO make php-fpm support this
|
// defines ini-settings in its pool config)
|
||||||
$php->getInterface()->createIniFile($phpconfig);
|
$php->getInterface()->createIniFile($phpconfig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -92,7 +88,7 @@ class nginx_phpfpm extends nginx
|
|||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
||||||
|
|
||||||
// get php.ini for our own vhost
|
// get php.ini for our own vhost
|
||||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
$php = new phpinterface($this->settings, $domain);
|
||||||
|
|
||||||
// get php-config
|
// get php-config
|
||||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||||
@@ -106,8 +102,8 @@ class nginx_phpfpm extends nginx
|
|||||||
// create starter-file | config-file
|
// create starter-file | config-file
|
||||||
$php->getInterface()->createConfig($phpconfig);
|
$php->getInterface()->createConfig($phpconfig);
|
||||||
|
|
||||||
// create php.ini
|
// create php.ini (fpm does nothing here, as it
|
||||||
// @TODO make php-fpm support this
|
// defines ini-settings in its pool config)
|
||||||
$php->getInterface()->createIniFile($phpconfig);
|
$php->getInterface()->createIniFile($phpconfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user