session save path permission issues
Hi try the below php code to set session variables;
$_SESSION["count"] = 1;
Hello visitor, you have seen this page <?php echo $_SESSION["count"]; ?> times.
If the above code does not work, problem might be in permissions of the folder in which the sessions are being saved. Test below function to know where your sessions are currently being saved:
After knowing the folder where your sessions are saved, check out the file permissions for that folder. If that folder does not have enough permissions, set permissions atleast 555 for that folder. Also check out the httpd_sys_content_t permission for that folder. To set this permission, use:
chcon -R -h -t httpd_sys_content_t foldername/ [note: this command in linux]
You can also set your own session_save_path by using below function: Note that setting the session_save_path should be done before session_start(). And also make sure the folder given in the session_save_path exists.