Session_start() php warning in Apache for windows configuration in php.ini

I have a php warning for a Windows 10 installation with Apache. It seems session_start gives a warning because Apache tries to set sessions in directory C:/Windows. I wanted to use C:/Windows/Temp .
Same code works correctly in Windows with Nginx server.

I have tried two solutions
a) php.ini set session.save_path= “C:/Windows/Temp”
b) using in php file :

if ( session_save_path() == '' && (stripos( $_SERVER['SERVER_SOFTWARE'],'apache')  > 0 ) && ( stripos( $_SERVER['WINDIR'],'windows')  > 0) )
        {
                ini_set('session.save_path',  $_SERVER['WINDIR'].'\Temp');
} session_start(); 

a) it does not work for me. I think php.ini should set session.save_path correctly if using Apache on Windows.
b) it works for me.

Please, can it be corrected in future installations?

This topic was automatically closed after 730 days. New replies are no longer allowed.