From 9fd93035af2c0c1f4eb36ca5f05a235cf68f4771 Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Wed, 02 Mar 2016 13:38:54 -0500 Subject: [PATCH] - make session.save_path overridable in php-fpm (Fixes #3791) --- server/plugins-available/apache2_plugin.inc.php | 6 +++++- server/plugins-available/nginx_plugin.inc.php | 4 ++++ server/conf/php_fpm_pool.conf.master | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/conf/php_fpm_pool.conf.master b/server/conf/php_fpm_pool.conf.master index 9bd7a3b..b60eb98 100644 --- a/server/conf/php_fpm_pool.conf.master +++ b/server/conf/php_fpm_pool.conf.master @@ -34,7 +34,7 @@ <tmpl_if name='security_level' op='==' value='20'> <tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'> -php_admin_value[session.save_path] = <tmpl_var name='document_root'>/tmp +<tmpl_if name='custom_session_save_path' op='!=' value='y'>php_admin_value[session.save_path] = <tmpl_var name='document_root'>/tmp</tmpl_if> php_admin_value[upload_tmp_dir] = <tmpl_var name='document_root'>/tmp php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -f webmaster@<tmpl_var name='domain'>" </tmpl_if> diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 03e2c8f..e635429 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -3146,6 +3146,7 @@ } } + $custom_session_save_path = false; 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); @@ -3161,6 +3162,7 @@ $value = trim($value); if($value != ''){ $key = trim($key); + if($key == 'session.save_path') $custom_session_save_path = true; switch (strtolower($value)) { case '0': // PHP-FPM might complain about invalid boolean value if you use 0 @@ -3181,7 +3183,9 @@ } } } - + + $tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n')); + $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings); $app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab()); diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 8daff10..c2b2abf 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -2757,6 +2757,7 @@ } } + $custom_session_save_path = false; 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); @@ -2772,6 +2773,7 @@ $value = trim($value); if($value != ''){ $key = trim($key); + if($key == 'session.save_path') $custom_session_save_path = true; switch (strtolower($value)) { case '0': // PHP-FPM might complain about invalid boolean value if you use 0 @@ -2793,6 +2795,8 @@ } } + $tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n')); + $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings); $app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab()); -- Gitblit v1.9.1