make session.save_path overridable in apache + fcgi

I needed it, so I made changes needed. I want you to pull this into sources, so my local changes dont get overwritten with update of ipsconfig (and maybe smb else will need it). I did changes based on 9fd93035 , basically changing one line in template for fcgi-launcher, and adding bunch of lines to pass php-ini settings (why not to user parse_ini_file()? ). Probably the right way to generalize code for passing custom php-ini settings, so you dont have duplicate code.


 ┗━━ # diff -u apache2_plugin.inc.php.bak apache2_plugin.inc.php
--- apache2_plugin.inc.php.bak  2018-01-06 09:35:50.000000000 +0000
+++ apache2_plugin.inc.php      2018-02-25 01:42:26.695968483 +0000
@@ -1431,6 +1431,31 @@
                                $default_fastcgi_php = true;
                        }

+                       $custom_php_ini_settings = trim($data['new']['custom_php_ini']);
+                       $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);
+                               $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){
+                                               $ini_setting = trim($ini_setting);
+                                               if(substr($ini_setting, 0, 1) == ';') continue;
+                                               if(substr($ini_setting, 0, 1) == '#') continue;
+                                               if(substr($ini_setting, 0, 2) == '//') continue;
+                                               list($key, $value) = explode('=', $ini_setting, 2);
+                                               $value = trim($value);
+                                               if($value != ''){
+                                                       $key = trim($key);
+                                                       if($key == 'session.save_path') $custom_session_save_path = true;
+                                               }
+                                       }
+                               }
+                       }
+
+                       $fcgi_tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n'));
+
                        if($has_custom_php_ini) {
                                $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir));
                        } else {

 ┗━━ # diff -u php-fcgi-starter.master.bak php-fcgi-starter.master
--- php-fcgi-starter.master.bak 2018-02-25 01:31:37.262979300 +0000
+++ php-fcgi-starter.master     2018-02-25 01:32:12.419899333 +0000
@@ -15,6 +15,6 @@
 exec <tmpl_var name='php_fcgi_bin'> \
 <tmpl_if name="security_level" op="==" value="20"> -d open_basedir="<tmpl_var name='open_basedir'>" \
 -d upload_tmp_dir=<tmpl_var name='document_root'>/tmp \
--d session.save_path=<tmpl_var name='document_root'>/tmp \}
+<tmpl_if name='custom_session_save_path' op='!=' value='y'>-d session.save_path=<tmpl_var name='document_root'>/tmp </tmpl_if> \
 -d sendmail_path="/usr/sbin/sendmail -t -i -f webmaster@<tmpl_var name='domain'>" \