Php session data is sometimes lost

We have a problem with the PHP session.

Sometimes our application has lost sessions. The circuit cannot be defined. In most cases (99.9%), an error does not occur.

This is a very large application (over 7000 PHP pages). The source code has not been changed since the problem occurred. PHP runs on IIS 7.5 and Windows Server 2008.

Session ID is properly migrated from the cookie. Session files that are affected are either no longer available, or empty or missing data. It looks like the data has been deleted because the file structure looks right.

Session capture works.

Sessions are stored in the SAN. We temporarily saved the session to the internal hard drive. The same result.

Does anyone have an idea to solve a problem?

Yours faithfully

Floor

PS. Sorry for my English!

+7
php session
source share
2 answers

If you have a session, try a session handler. You probably don't want to hardcode all of these pages, but there are certainly one or more losers. In addition, this is due to browser restrictions. If I started a session in IE and then the admin login in Chrome will kill the first session in essence, since the other session is no longer recognized when restoring the SAN. By the way, your session wait period is not mentioned, but you are talking about (more than 7000 PHP pages). I would advise you to create a session variable and pass it instead of relying on a cookie if your pages do not streamline the release or update a lot, why do you use cookies. However, you will need to make sure that all sets of variables are unique.

-one
source share

You should check each of your pages if a particular session is established or not. This is a good programming method. Did you use it in your php code? You can find the page where your data is lost, and then apply the php code on this page.

if(isset($_POST['your_session'])){ //body; } else{ echo '<script type="text/javascript">'. 'alert("Session not set !");'. '</script>'; } 

This code will give you an error message on behalf of your sessions.

-one
source share

All Articles