PHP Sessions

software development

#1

Hi,
I am trying to get a new website going on Dreamhosts and I am unable to store serialized objects in the session. The code works perfectly in development (localhost), but not at all in my spanking new webspace.

I have checked the phpinfo details for serialization and sessions and it looks fine.

Does anyone have any ideas?

Thanks


#2

Are you running the same version of PHP on your development site as on Dreamhost (PHP4 vs PHP5)?

–rlparker


#3

Hi,
At Dreamhosts: PHP Version 5.1.2

At home: PHP Version 5.1.4

I would have thought that would be ok.


#4

I think so, too. My first thought was that if one was running PHP4, there might be differences in the handling/naming of certain sessions related variables, but since you are running PHP5 on both I don’t think tat is the case.

Are they both running as CGI, or is your development system running mod_php? (I’m just trying to determine what is different between the two systems).

–rlparker


#5

If you go here, are you violating any of the cautions or warnings? Or, take a look at the settings in php.ini to see if there are any differences between your configs.

http://www.php.net/manual/en/ref.session.php

Terry


#6

I have more information. From testing, I can see that the session does work within the same request. However, I am losing all my session variables between requests.

Sessions work for an admin portion of the website.

The session id is not changing, so I guess that means the cookie is working ok.

Session gc_maxlifetime is the default, 1440.

The save_path is the same and working as for the admin side.

I feel as though the solution is staring at me but I can’t see it at the moment.


#7

did you ever find a solution to this problem? i’m having the same one. non-persistent session variables across page requests. thanks.


#8

Hi,
Yes. The problem was in a content management system called Mambo that I am using. It was resetting the $_SESSION variables for some unknown reason. It took me ages to find the problem. I spent 10 hours trawling thru all my stuff without finding anything wrong. In the end I suspected it was the Mambo code, so I scanned their PHP code and found some weird code which was playing around with the session.

So the good news is that sessions work fine.

Search for sessions at www.php.net.

I’m sorry I can’t do much to help you at the moment, but I on vacation in Sweden and do not have internet access where I am staying. Let me know if you still have problems next week and I will have a look at your code, or whatever will get you going.

Brian


#9

PostNuke’s sessions work fine across requests. Give it a try…