give possibility to change php.ini-values for fpm-pool configurations (only pre-defined sections are possible for now), refs #587
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -39,6 +39,23 @@ class phpinterface_fpm
|
||||
*/
|
||||
private $_domain = array();
|
||||
|
||||
/**
|
||||
* Admin-Date cache array
|
||||
* @var array
|
||||
*/
|
||||
private $_admin_cache = array();
|
||||
|
||||
/**
|
||||
* defines what can be used for pool-config from php.ini
|
||||
* @var array
|
||||
*/
|
||||
private $_ini = array(
|
||||
'php_value' => array('error_reporting', 'max_execution_time', 'include_path', 'upload_max_filesize'),
|
||||
'php_flag' => array('short_open_tag', 'asp_tags', 'display_errors', 'display_startup_errors', 'log_errors', 'log_errors_max_len', 'track_errors', 'html_errors', 'magic_quotes_gpc', 'magic_quotes_runtime', 'magic_quotes_sybase'),
|
||||
'php_admin_value' => array('precision', 'output_buffering', 'disable_functions', 'max_input_time', 'memory_limit', 'post_max_size', 'variables_order', 'gpc_order', 'date.timezone'),
|
||||
'php_admin_flag' => array('allow_call_time_pass_reference', 'allow_url_fopen', 'expose_php', 'ignore_repeated_errors', 'ignore_repeated_source', 'report_memleaks', 'register_argc_argv', 'file_uploads', 'allow_url_fopen')
|
||||
);
|
||||
|
||||
/**
|
||||
* main constructor
|
||||
*/
|
||||
@@ -168,11 +185,42 @@ class phpinterface_fpm
|
||||
$fpm_config.= 'php_admin_value[session.save_path] = ' . 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']);
|
||||
$php_ini_variables = array(
|
||||
'SAFE_MODE' => 'Off', // keep this for compatibility, just in case
|
||||
'PEAR_DIR' => $this->_settings['system']['mod_fcgid_peardir'],
|
||||
'TMP_DIR' => $this->getTempDir(),
|
||||
'CUSTOMER_EMAIL' => $this->_domain['email'],
|
||||
'ADMIN_EMAIL' => $admin['email'],
|
||||
'DOMAIN' => $this->_domain['domain'],
|
||||
'CUSTOMER' => $this->_domain['loginname'],
|
||||
'ADMIN' => $admin['loginname']
|
||||
);
|
||||
|
||||
$phpini = replace_variables($phpconfig['phpsettings'], $php_ini_variables);
|
||||
$phpini_array = explode("\n", $phpini);
|
||||
|
||||
$fpm_config.= "\n\n";
|
||||
foreach ($phpini_array as $inisection) {
|
||||
$is = explode("=", $inisection);
|
||||
foreach ($this->_ini as $sec => $possibles) {
|
||||
if (in_array(trim($is[0]), $possibles)) {
|
||||
$fpm_config.= $sec.'['.trim($is[0]).'] = ' . trim($is[1]) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($fh, $fpm_config, strlen($fpm_config));
|
||||
fclose($fh);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* this is done via createConfig as php-fpm defines
|
||||
* the ini-values/flags in its pool-config
|
||||
*
|
||||
* @param string $phpconfig
|
||||
*/
|
||||
public function createIniFile($phpconfig)
|
||||
{
|
||||
return;
|
||||
@@ -263,4 +311,24 @@ class phpinterface_fpm
|
||||
|
||||
return $configdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the admin-data of a specific admin
|
||||
*
|
||||
* @param int $adminid id of the admin-user
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _getAdminData($adminid) {
|
||||
$adminid = intval($adminid);
|
||||
|
||||
if (!isset($this->_admin_cache[$adminid])) {
|
||||
$this->_admin_cache[$adminid] = $this->_db->query_first(
|
||||
"SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
|
||||
WHERE `adminid` = " . (int)$adminid
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_admin_cache[$adminid];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,12 +245,8 @@ return array (
|
||||
'url' => 'admin_phpsettings.php?page=overview',
|
||||
'label' => $lng['menue']['phpsettings']['maintitle'],
|
||||
'show_element' => (
|
||||
getSetting('system', 'mod_fcgid') == true
|
||||
/*
|
||||
* @TODO activate if phpfpm knows custom php.ini files
|
||||
*
|
||||
* || getSetting('phpfpm', 'enabled') == true
|
||||
*/
|
||||
getSetting('system', 'mod_fcgid') == true ||
|
||||
getSetting('phpfpm', 'enabled') == true
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1957,3 +1957,5 @@ $lng['error']['sslcertificateinvalidca'] = 'The given CA certificate data does n
|
||||
$lng['error']['sslcertificateinvalidchain'] = 'The given certificate chain data does not seem to be a valid certificate';
|
||||
$lng['serversettings']['customerssl_directory']['title'] = 'Webserver customer-ssl certificates-directory';
|
||||
$lng['serversettings']['customerssl_directory']['description'] = 'Where should customer-specified ssl-certificates be created?';
|
||||
$lng['admin']['note'] = 'Please note';
|
||||
$lng['admin']['phpfpm.ininote'] = 'Not all values you may want to define can be used in the php-fpm pool configuration';
|
||||
|
||||
@@ -1678,3 +1678,5 @@ $lng['error']['sslcertificateinvalidca'] = 'Die angegebenen CA-Zertifikatsdaten
|
||||
$lng['error']['sslcertificateinvalidchain'] = 'Die angegebenen Zertifikats-Chain-Daten scheinen kein gültiges Zertifikat zu sein';
|
||||
$lng['serversettings']['customerssl_directory']['title'] = 'Webserver-Kunden-SSL-Zertifikats-Verzeichnis';
|
||||
$lng['serversettings']['customerssl_directory']['description'] = 'Wo sollen kundenspezifizierte SSL-Zertifikate erstellt werden?';
|
||||
$lng['admin']['note'] = 'Bitte beachten';
|
||||
$lng['admin']['phpfpm.ininote'] = 'Nicht alle gewünschten Werte können in der php-fpm pool Konfiguration verwendet werden';
|
||||
|
||||
@@ -7,6 +7,15 @@ $header
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<if $settings['phpfpm']['enabled'] == 1 >
|
||||
<div class="messagewrapperfull">
|
||||
<div class="warningcontainer bradius">
|
||||
<div class="warningtitle">{$lng['admin']['note']}</div>
|
||||
<div class="warning"><br /><strong>{$lng['admin']['phpfpm.ininote']}</strong></div>
|
||||
</div>
|
||||
</div>
|
||||
</if>
|
||||
|
||||
<section>
|
||||
|
||||
<if 15 < $count>
|
||||
|
||||
Reference in New Issue
Block a user