If I have 3 php scripts (Text1.php, Text2.php and Text3.php), when I use session_save_path(), is it better if all the session details are saved into one file or should it be saved in seperate files?
In other words does the code below go into Text1.php, Text2.php and Text3.php:
session_save_path("helios.hud.ac.uk/u09999999/Computer_app/sessionData.php");
OR
should it be Text1.php:
session_save_path("helios.hud.ac.uk/u09999999/Computer_app/sessionData1.php");
Text2.php
session_save_path("helios.hud.ac.uk/u09999999/Computer_app/sessionData2.php");
Text3.php
session_save_path("helios.hud.ac.uk/u09999999/Computer_app/sessionData3.php");
You’ll need to have all three scripts use the same path if you want them to share session data, which is kinda the point of sessions.
Also, session_save_path() sets the name of the directory to use, not the name of the file. PHP will determine the file name.
So use one value for all scripts:
Or better, set it in an init script that gets included from each script:
Edit: Also, make sure that the directory can be written to by the process that runs the web server. And note that you may also set this value globally by editing the appropriate line in your php.ini, wherever that may be stored on your particular system.