Has ANYBODY ever gotten sessions to work correctly in PHP 5.2? I have WinXP/PHP 5.2/Apache 2.2. I've tried a lot of different things from different forums and NOTHING has worked. Could this be a bug in 5.2? If anyone has working sessions in 5.2 on Windows, please post here how you configured it so those of us who haven't figured it out can bow to you.I'm sure sessions work fine in that version of PHP.
You simply need to follow all the instructions.
This starts by enabling error_reporting(E_ALL) and looking at any errors produced.
You also need a browser which accepts cookies on / for the host name you're using. This is not difficult, really.
MarkYep. Did all that. No errors via PHP or Apache. PHP otherwise works *perfectly*. I've tested a lot of different things. Only sessions are screwed up.
This is frustrating. I'm not a newbie at this.
php.ini (<!-- m --><a class="postlink" href="http://audiodef.com/php.ini">http://audiodef.com/php.ini</a><!-- m -->) , if this helps.Are you trying to use query strings to maintain the session?
My recommendation is - DON'T use query strings. Use cookies. Enable session.use_cookies and session.use_only_cookies.
Don't enable trans_sid or whatever the function is which messes your HTML around.
If you put the session ID in the query string, it will appear in other sites' referrer logs and other places which are undesirable. It also allows for session fixation attacks (potentially).
MarkThis problem also puzzled the hell out of me... but I finally got it nailed down, at least, as far as I can tell ... in my PHP.ini I had these two lines
upload_tmp_dir="C:\DOCUME~1\Sam\LOCALS~1\Temp\php\session"
session.save_path="C:\DOCUME~1\Sam\LOCALS~1\Temp\php\upload"
it turned out that the path didn't exist, so I made sure it was available ... this blew the problem right out of the water.
I hope it works for you too ... I think I'm best described as a newbie ... so please guys, if what I said sounds lame, don't hold it against me...Both above suggestions *should* fix the problem, but they just didn't. In any case, I'm tossing WindBloze out the windoze and going Linux.Sessions work absolutely fine in every version of PHP, even in Windows.
If they don't on yours, it's because something is set up wrong.
You MUST enable all errors and warnings and ensure that error logging is happening - otherwise, errors could happen (e.g. sessions directory doesn't exist) which are invisible.
It WILL WORK. You clearly have something wrong.
It might be a client-side issue- ensure that you're using a proper domain name on the browser, cookies are definitely enabled etc (bear in mind that some browsers are picky about enabling cookies on some sites, particularly if you have a "funny" host name). Test cookies independently.
Ensure that any application-level firewalls or antivirus apps are not causing a problem, if in doubt, uninstall them all. I've had both cause problems before.
Mark
You simply need to follow all the instructions.
This starts by enabling error_reporting(E_ALL) and looking at any errors produced.
You also need a browser which accepts cookies on / for the host name you're using. This is not difficult, really.
MarkYep. Did all that. No errors via PHP or Apache. PHP otherwise works *perfectly*. I've tested a lot of different things. Only sessions are screwed up.
This is frustrating. I'm not a newbie at this.
php.ini (<!-- m --><a class="postlink" href="http://audiodef.com/php.ini">http://audiodef.com/php.ini</a><!-- m -->) , if this helps.Are you trying to use query strings to maintain the session?
My recommendation is - DON'T use query strings. Use cookies. Enable session.use_cookies and session.use_only_cookies.
Don't enable trans_sid or whatever the function is which messes your HTML around.
If you put the session ID in the query string, it will appear in other sites' referrer logs and other places which are undesirable. It also allows for session fixation attacks (potentially).
MarkThis problem also puzzled the hell out of me... but I finally got it nailed down, at least, as far as I can tell ... in my PHP.ini I had these two lines
upload_tmp_dir="C:\DOCUME~1\Sam\LOCALS~1\Temp\php\session"
session.save_path="C:\DOCUME~1\Sam\LOCALS~1\Temp\php\upload"
it turned out that the path didn't exist, so I made sure it was available ... this blew the problem right out of the water.
I hope it works for you too ... I think I'm best described as a newbie ... so please guys, if what I said sounds lame, don't hold it against me...Both above suggestions *should* fix the problem, but they just didn't. In any case, I'm tossing WindBloze out the windoze and going Linux.Sessions work absolutely fine in every version of PHP, even in Windows.
If they don't on yours, it's because something is set up wrong.
You MUST enable all errors and warnings and ensure that error logging is happening - otherwise, errors could happen (e.g. sessions directory doesn't exist) which are invisible.
It WILL WORK. You clearly have something wrong.
It might be a client-side issue- ensure that you're using a proper domain name on the browser, cookies are definitely enabled etc (bear in mind that some browsers are picky about enabling cookies on some sites, particularly if you have a "funny" host name). Test cookies independently.
Ensure that any application-level firewalls or antivirus apps are not causing a problem, if in doubt, uninstall them all. I've had both cause problems before.
Mark