Skip to content

Commit 9fd9303

Browse files
author
Marius Burkard
committed
- make session.save_path overridable in php-fpm (Fixes #3791)
1 parent 93292a9 commit 9fd9303

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

server/conf/php_fpm_pool.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ env[TEMP] = <tmpl_var name='document_root'>/tmp
3434

3535
<tmpl_if name='security_level' op='==' value='20'>
3636
<tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>
37-
php_admin_value[session.save_path] = <tmpl_var name='document_root'>/tmp
37+
<tmpl_if name='custom_session_save_path' op='!=' value='y'>php_admin_value[session.save_path] = <tmpl_var name='document_root'>/tmp</tmpl_if>
3838
php_admin_value[upload_tmp_dir] = <tmpl_var name='document_root'>/tmp
3939
php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -f webmaster@<tmpl_var name='domain'>"
4040
</tmpl_if>

server/plugins-available/apache2_plugin.inc.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3146,6 +3146,7 @@ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name,
31463146
}
31473147
}
31483148

3149+
$custom_session_save_path = false;
31493150
if($custom_php_ini_settings != ''){
31503151
// Make sure we only have Unix linebreaks
31513152
$custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings);
@@ -3161,6 +3162,7 @@ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name,
31613162
$value = trim($value);
31623163
if($value != ''){
31633164
$key = trim($key);
3165+
if($key == 'session.save_path') $custom_session_save_path = true;
31643166
switch (strtolower($value)) {
31653167
case '0':
31663168
// PHP-FPM might complain about invalid boolean value if you use 0
@@ -3181,7 +3183,9 @@ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name,
31813183
}
31823184
}
31833185
}
3184-
3186+
3187+
$tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n'));
3188+
31853189
$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
31863190

31873191
$app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());

server/plugins-available/nginx_plugin.inc.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,6 +2757,7 @@ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name,
27572757
}
27582758
}
27592759

2760+
$custom_session_save_path = false;
27602761
if($custom_php_ini_settings != ''){
27612762
// Make sure we only have Unix linebreaks
27622763
$custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings);
@@ -2772,6 +2773,7 @@ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name,
27722773
$value = trim($value);
27732774
if($value != ''){
27742775
$key = trim($key);
2776+
if($key == 'session.save_path') $custom_session_save_path = true;
27752777
switch (strtolower($value)) {
27762778
case '0':
27772779
// PHP-FPM might complain about invalid boolean value if you use 0
@@ -2793,6 +2795,8 @@ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name,
27932795
}
27942796
}
27952797

2798+
$tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n'));
2799+
27962800
$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
27972801

27982802
$app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());

0 commit comments

Comments
 (0)