Shoutbox

PHP: A question for the pros - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: PHP: A question for the pros (/showthread.php?tid=51758)

PHP: A question for the pros by lhunath on 10-13-2005 at 08:18 PM

Let me start of by appologising for putting this question on a forum about Messenger Plus!. However; I know there's plenty of smart people out here that have extensive experience with PHP which is the reason why I decided to seek assistance here.

I've an issue with my webserver Apache which has been set up to use the PHP module (5.0).
I've root access to all of the server, so I can easily change everything. I've a hunch this is where things started going wrong in the first place as well. Let me detail the situation.

The problem is to do with Sessions.
My PHP scripts can successfully start sessions and I get a SESSION ID assigned for each. Session data is stored to the session.save_path I've set in my php.ini file.
When session.save_handler is set to "files"; session files are made in the folder (it's /tmp/php). They contain the session data. All well so far.
This is where it starts going wrong. Session variables are only just added to the session data file. They are never *updated*. For example; my initial session value for the variable "lang" is "nl". When I click the button to change the language to "fr"; on the next page the value of the variable changes to "fr", since it was passed using POST. My script runs _SESSION["lang"] = "fr"; on that page everything looks french; however, when we click the next link -- everything reverts to "nl" since the session data was not updated and is still "nl" in the session file. The original value.

I pray any of you have a sollution for this issue. I need to get the website of a company online *this* week. If you can't assist me -- please do redirect me elsewhere.

And no -- the issue has nothing to do with my PHP script. The code works perfectly on another server. The issue must be something to do with my apache/php/linux configuration.

For your information; the /tmp/php folder has as user "root"; as group "apache" (tried "nobody", too). As permissions the mask 770 (777 doesn't work either). I doubt permissions are the issue as the files are indeed written to disk - just not updated.

Thank you so much for you interest and moment of thought,
~lhunath


RE: PHP: A question for the pros by brian on 10-13-2005 at 09:54 PM

Odd..

Tried comparing Apache/PHP configs between the two servers?

Anyhow, is the other server running PHP4 or PHP5? Some features or w/e could be different.

Anyways, care to tell me if your register_globals is enabled? aswell as posting the configs?

For more help, refer this page too, http://www.php.net/session


RE: PHP: A question for the pros by J-Thread on 10-14-2005 at 09:24 AM

Can you please post the header of your scripts here? I mean session_start() and all the code where you set and load your session vars...


RE: PHP: A question for the pros by brian on 10-14-2005 at 10:33 AM

He read and said it completely functioned on another server, J-Thread, it's probably not his code.


RE: PHP: A question for the pros by J-Thread on 10-14-2005 at 02:03 PM

I know, but there are 2 ways to solve this problem.

1: change his config and make the script work
2: change the script so it works on both servers

Besides that, it may be usefull information to exactly know how he manage his sessions...


RE: PHP: A question for the pros by lhunath on 10-15-2005 at 06:58 PM

The code is mine; but I have no access to the Apache/PHP configs on the other server.

Things went as they do far too often sadly -- I mucked about with a basic script -- trying to reproduce the problem. Sessions seemed to work flawlessly there. So I took it my session handling functions were flawed. I fixed those up (none of the fixes should have caused anything near what I discribed in the first post), enaled register_globals (for which I'd written a workaround as well -- my scripts sadly rely on register globals but I had written some code to automatically register all REQUEST variables as globally available in case the server didn't support register_globals. Point is - it now works and I changed so much inbetween testing I haven't a clue which of the changes fixed the damn thing.

Anyhow, I'm flattered with the interest and would like to gracefully thank you all for your replies. May whatever God you believe in grant you whatever it is you wish for most -- except if it's total world domination or something of that kind.

Thanks again :)
and au revoir,
~ lhunath