php sessions under php 7 and cmsb v3.53
I facing problem with PHP session variables under php 7.2 and cmsB v3.53
Using the attached script that I "require" at the top of every page for multi language management purposes.
For some reason the php sessions cannot keep the value after i reload or navigate to other page.
Any help will be appreciated,
This is something that can happen if your server is trying to include/require the file as a "URL" rather than a local file. I'm not sure exactly why this sometimes happens, but I've been able to resolve the issue in the past by adding a "./" to the front of the include/require path, changing from something like this:
<?php require "languages.php"; ?>
<?php require "./languages.php"; ?>
Another option is to use the full local path to the file (starting with "C:/" on Windows or "/" on Linux), though that can be more complicated to maintain.
Let me know if that helps with your issue!
Thanks for your quick reply.
Unfortunately this is not it. Nothing change by playing the path of the included file.
Is there anything changed with the php session.cookie_* or any session related settings in the php.ini (like session.save_path or session.use_cookies) in php 7 that maybe affect or conflict with my old script?
PS: Everything working fine in php 5.6
I tried testing your script locally on PHP 7.2.4 and was unfortunately unable to reproduce the results - this is pretty typical session use, so I can't think of anything obvious that would cause you to lose the values.
Could you show me an example of a page that requires languages.php? This might provide some additional clues, or at least help rule out if this is a code issue vs. a server config issue.
By default session variables are stored in the gobal /tmp directory on unix based systems. Housekeeping routines at the server level can clear the /tmp directory on a regular basis. If possible use the users home tmp directory in session.save_path instead of the default.