php sessions under php 7 and cmsb v3.53

7 posts by 3 authors in: Forums > CMS Builder
Last Post: December 11, 2019   (RSS)

By ht1080z - November 25, 2019

Hi,

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,
Karls

Attachments:

languages.php 1K

By daniel - November 25, 2019

Hi Karls,

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"; ?>

To this:

<?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,

Daniel

Technical Lead

interactivetools.com

By ht1080z - November 25, 2019 - edited: November 25, 2019

Hi Daniel,

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

Thank you,
Karls

By daniel - December 4, 2019

Hi Karls,

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.

Thanks,

Daniel

Technical Lead

interactivetools.com

By ht1080z - December 5, 2019

Hi Daniel,

Thanks for the follow up. Unfortunately I didn't found a solution yet but it is have to do something with my script (the sessions works with a naked script and included language.php)

I'm working on a solution step by step.

Regards,
Karls

By ht1080z - December 11, 2019

Hi Jeff,

Thanks for the tip, will try it soon.

Karls