Commit 4986189f authored by Falko Timme's avatar Falko Timme

Added custom php.ini directives to nginx + PHP-FPM.

parent 40cf9835
......@@ -171,46 +171,14 @@
function adjustForm(serverType){
if(serverType == "nginx"){
jQuery('.nginx').show();
/*
jQuery('#nginx_vhost_conf_dir').closest('div.ctrlHolder').show();
jQuery('#nginx_vhost_conf_enabled_dir').closest('div.ctrlHolder').show();
jQuery('#nginx_user').closest('div.ctrlHolder').show();
jQuery('#nginx_group').closest('div.ctrlHolder').show();
jQuery('#nginx_cgi_socket').closest('div.ctrlHolder').show();
*/
jQuery('.apache').hide();
/*
jQuery('#vhost_conf_dir').closest('div.ctrlHolder').hide();
jQuery('#vhost_conf_enabled_dir').closest('div.ctrlHolder').hide();
jQuery('#security_level').closest('div.ctrlHolder').hide();
jQuery('#check_apache_config').closest('div.ctrlHolder').hide();
jQuery('#user').closest('div.ctrlHolder').hide();
jQuery('#group').closest('div.ctrlHolder').hide();
jQuery('#php_ini_path_apache').closest('div.ctrlHolder').hide();
jQuery('#htaccess_allow_override').closest('div.ctrlHolder').hide();
*/
//jQuery('.tabbox_tabs li').find(":contains('FastCGI')").hide();
//jQuery('.tabbox_tabs li').find(":contains('FastCGI')").remove();
} else {
jQuery('.nginx').hide();
/*
jQuery('#nginx_vhost_conf_dir').closest('div.ctrlHolder').hide();
jQuery('#nginx_vhost_conf_enabled_dir').closest('div.ctrlHolder').hide();
jQuery('#nginx_user').closest('div.ctrlHolder').hide();
jQuery('#nginx_group').closest('div.ctrlHolder').hide();
jQuery('#nginx_cgi_socket').closest('div.ctrlHolder').hide();
*/
jQuery('.apache').show();
/*
jQuery('#vhost_conf_dir').closest('div.ctrlHolder').show();
jQuery('#vhost_conf_enabled_dir').closest('div.ctrlHolder').show();
jQuery('#security_level').closest('div.ctrlHolder').show();
jQuery('#check_apache_config').closest('div.ctrlHolder').show();
jQuery('#user').closest('div.ctrlHolder').show();
jQuery('#group').closest('div.ctrlHolder').show();
jQuery('#php_ini_path_apache').closest('div.ctrlHolder').show();
jQuery('#htaccess_allow_override').closest('div.ctrlHolder').show();
*/
//jQuery('.tabbox_tabs li').find(":contains('FastCGI')").show();
//jQuery('.tabbox_tabs li:eq(4)').after('<li><a href="javascript:changeTab(\'fastcgi\',\'admin/server_config_edit.php\')">FastCGI</a></li>');
}
}
</script>
\ No newline at end of file
......@@ -13,4 +13,7 @@ pm.max_spare_servers = 35
chdir = /
<tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>
\ No newline at end of file
<tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>
<tmpl_loop name="custom_php_ini_settings">
<tmpl_var name='ini_setting'>
</tmpl_loop>
\ No newline at end of file
......@@ -1065,7 +1065,7 @@ class nginx_plugin {
return;
}
if(!@is_file($pool_dir.'/'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
//if(!@is_file($pool_dir.'/'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
if ( @is_file($pool_dir.'/'.$data['old']['domain'].'.conf') ) {
unlink($pool_dir.'/'.$data['old']['domain'].'.conf');
}
......@@ -1089,11 +1089,46 @@ class nginx_plugin {
$tpl->setVar('enable_php_open_basedir', ';');
}
// Custom php.ini settings
$final_php_ini_settings = array();
$custom_php_ini_settings = trim($data['new']['custom_php_ini']);
if($custom_php_ini_settings != ''){
// Make sure we only have Unix linebreaks
$custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings);
$custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings);
$ini_settings = explode("\n", $custom_php_ini_settings);
if(is_array($ini_settings) && !empty($ini_settings)){
foreach($ini_settings as $ini_setting){
list($key, $value) = explode('=', $ini_setting);
if($value){
$value = trim($value);
$key = trim($key);
switch (strtolower($value)) {
case 'on':
case 'off':
case '1':
case '0':
case 'true':
case 'false':
case 'yes':
case 'no':
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
break;
default:
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
}
}
}
}
}
$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
file_put_contents($pool_dir.'/'.$data['new']['domain'].'.conf',$tpl->grab());
$app->log('Writing the PHP-FPM config file: '.$pool_dir.'/'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
unset($tpl);
//$reload = true;
}
//}
//if($reload == true) $app->services->restartService('php-fpm','reload');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment