enhance php-fpm configuration options to use custom-ini-settings, refs #587
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -54,9 +54,16 @@ return array(
|
||||
'default' => 'froxlorlocal',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
/*
|
||||
* @TODO implement if phpfpm knows custom php.ini files
|
||||
*
|
||||
'system_phpfpm_defaultini' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'defaultini',
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_phpfpm_defaultini_ownvhost' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
@@ -67,7 +74,6 @@ return array(
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
*/
|
||||
'system_phpfpm_configdir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
|
||||
@@ -343,7 +343,7 @@ if($page == 'domains'
|
||||
{
|
||||
$openbasedir = isset($_POST['openbasedir']) ? intval($_POST['openbasedir']) : 0;
|
||||
|
||||
if((int)$settings['system']['mod_fcgid'] == 1)
|
||||
if((int)$settings['system']['mod_fcgid'] == 1 || (int)$settings['phpfpm']['enabled'] == 1)
|
||||
{
|
||||
$phpsettingid = (int)$_POST['phpsettingid'];
|
||||
$phpsettingid_check = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$phpsettingid);
|
||||
@@ -360,7 +360,11 @@ if($page == 'domains'
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpsettingid = $settings['system']['mod_fcgid_defaultini'];
|
||||
if ((int)$settings['phpfpm']['enabled'] == 1) {
|
||||
$phpsettingid = $settings['phpfpm']['defaultini'];
|
||||
} else {
|
||||
$phpsettingid = $settings['system']['mod_fcgid_defaultini'];
|
||||
}
|
||||
$mod_fcgid_starter = '-1';
|
||||
$mod_fcgid_maxrequests = '-1';
|
||||
}
|
||||
@@ -368,7 +372,11 @@ if($page == 'domains'
|
||||
else
|
||||
{
|
||||
$openbasedir = '1';
|
||||
$phpsettingid = $settings['system']['mod_fcgid_defaultini'];
|
||||
if ((int)$settings['phpfpm']['enabled'] == 1) {
|
||||
$phpsettingid = $settings['phpfpm']['defaultini'];
|
||||
} else {
|
||||
$phpsettingid = $settings['system']['mod_fcgid_defaultini'];
|
||||
}
|
||||
$mod_fcgid_starter = '-1';
|
||||
$mod_fcgid_maxrequests = '-1';
|
||||
}
|
||||
@@ -686,7 +694,11 @@ if($page == 'domains'
|
||||
|
||||
while($row = $db->fetch_array($configs))
|
||||
{
|
||||
$phpconfigs.= makeoption($row['description'], $row['id'], $settings['system']['mod_fcgid_defaultini'], true, true);
|
||||
if ((int)$settings['phpfpm']['enabled'] == 1) {
|
||||
$phpconfigs.= makeoption($row['description'], $row['id'], $settings['phpfpm']['defaultini'], true, true);
|
||||
} else {
|
||||
$phpconfigs.= makeoption($row['description'], $row['id'], $settings['system']['mod_fcgid_defaultini'], true, true);
|
||||
}
|
||||
}
|
||||
|
||||
$subcanemaildomain = makeoption($lng['admin']['subcanemaildomain']['never'], '0', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['always'], '3', '0', true, true);
|
||||
|
||||
@@ -413,6 +413,8 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('phpfpm', 'vhost_httpgroup', 'froxlorlocal'),
|
||||
('phpfpm', 'idle_timeout', '30'),
|
||||
('phpfpm', 'aliasconfigdir', '/var/www/php-fpm/'),
|
||||
('phpfpm', 'defaultini', '1'),
|
||||
('phpfpm', 'vhost_defaultini', '1'),
|
||||
('nginx', 'fastcgiparams', '/etc/nginx/fastcgi_params'),
|
||||
('system', 'lastaccountnumber', '0'),
|
||||
('system', 'lastguid', '9999'),
|
||||
|
||||
@@ -2140,5 +2140,12 @@ if (isFroxlorVersion('0.9.29-dev4')) {
|
||||
$db->query("UPDATE `panel_settings` SET `varname` = 'vmail_maildirname' WHERE `settinggroup` = 'system' AND `varname` = 'vmail_maildir'");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("setting default php-configuration for php-fpm", true);
|
||||
$dval = (isset($settings['system']['mod_fcgid_defaultini']) ? $settings['system']['mod_fcgid_defaultini'] : '1');
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'phpfpm', `varname` = 'defaultini', `value` = '".(int)$dval."'");
|
||||
$dval = (isset($settings['system']['mod_fcgid_ownvhost']) ? $settings['system']['mod_fcgid_ownvhost'] : '1');
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'phpfpm', `varname` = 'vhost_defaultini', `value` = '".(int)$dval."'");
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToVersion('0.9.29-rc1');
|
||||
}
|
||||
|
||||
@@ -50,10 +50,49 @@ class phpinterface_fpm
|
||||
* @var array
|
||||
*/
|
||||
private $_ini = array(
|
||||
'php_value' => array('error_reporting', 'max_execution_time', 'include_path', 'upload_max_filesize', 'log_errors_max_len'),
|
||||
'php_flag' => array('short_open_tag', 'asp_tags', 'display_errors', 'display_startup_errors', 'log_errors', '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')
|
||||
'php_value' => array(
|
||||
'error_reporting',
|
||||
'max_execution_time',
|
||||
'include_path',
|
||||
'upload_max_filesize',
|
||||
'log_errors_max_len'
|
||||
),
|
||||
'php_flag' => array(
|
||||
'short_open_tag',
|
||||
'asp_tags',
|
||||
'display_errors',
|
||||
'display_startup_errors',
|
||||
'log_errors',
|
||||
'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',
|
||||
'cgi.force_redirect',
|
||||
'enable_dl',
|
||||
'expose_php',
|
||||
'ignore_repeated_errors',
|
||||
'ignore_repeated_source',
|
||||
'report_memleaks',
|
||||
'register_argc_argv',
|
||||
'file_uploads',
|
||||
'allow_url_fopen'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -297,10 +336,10 @@ class phpinterface_fpm
|
||||
*/
|
||||
public function getAliasConfigDir($createifnotexists = true)
|
||||
{
|
||||
// ensure default...
|
||||
if (!isset($this->_settings['phpfpm']['aliasconfigdir'])) {
|
||||
$this->_settings['phpfpm']['aliasconfigdir'] = '/var/www/php-fpm';
|
||||
}
|
||||
// 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)
|
||||
|
||||
@@ -164,7 +164,7 @@ return array(
|
||||
'value' => array('1')
|
||||
),
|
||||
'phpsettingid' => array(
|
||||
'visible' => ((int)$settings['system']['mod_fcgid'] == 1 ? true : false),
|
||||
'visible' => (((int)$settings['system']['mod_fcgid'] == 1 || (int)$settings['phpfpm']['enabled'] == 1) ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['title'],
|
||||
'type' => 'select',
|
||||
'select_var' => $phpconfigs
|
||||
|
||||
@@ -186,7 +186,7 @@ return array(
|
||||
'value' => array($result['openbasedir'])
|
||||
),
|
||||
'phpsettingid' => array(
|
||||
'visible' => ((int)$settings['system']['mod_fcgid'] == 1 ? true : false),
|
||||
'visible' => (((int)$settings['system']['mod_fcgid'] == 1 || (int)$settings['phpfpm']['enabled'] == 1) ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['title'],
|
||||
'type' => 'select',
|
||||
'select_var' => $phpconfigs
|
||||
|
||||
@@ -146,8 +146,14 @@ class apache_fcgid extends apache
|
||||
// get php.ini for our own vhost
|
||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
||||
|
||||
// @FIXME don't use fcgid settings if not fcgid in use, but we don't have anything else atm
|
||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||
// get php-config
|
||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||
// fpm
|
||||
$phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']);
|
||||
} else {
|
||||
// fcgid
|
||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||
}
|
||||
|
||||
// create starter-file | config-file
|
||||
$php->getInterface()->createConfig($phpconfig);
|
||||
|
||||
@@ -147,8 +147,14 @@ class lighttpd_fcgid extends lighttpd
|
||||
// get php.ini for our own vhost
|
||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
||||
|
||||
// @FIXME don't use fcgid settings, but we don't have anything else atm
|
||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||
// get php-config
|
||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||
// fpm
|
||||
$phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']);
|
||||
} else {
|
||||
// fcgid
|
||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||
}
|
||||
|
||||
// create starter-file | config-file
|
||||
$php->getInterface()->createConfig($phpconfig);
|
||||
|
||||
@@ -94,8 +94,14 @@ class nginx_phpfpm extends nginx
|
||||
// get php.ini for our own vhost
|
||||
$php = new phpinterface($this->getDB(), $this->settings, $domain);
|
||||
|
||||
// @FIXME don't use fcgid settings, but we don't have anything else atm
|
||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||
// get php-config
|
||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||
// fpm
|
||||
$phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']);
|
||||
} else {
|
||||
// fcgid
|
||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||
}
|
||||
|
||||
// create starter-file | config-file
|
||||
$php->getInterface()->createConfig($phpconfig);
|
||||
|
||||
Reference in New Issue
Block a user