Page 1 of 1

Session Problem

Posted: Thu Dec 04, 2003 3:15 pm
by partiallynothing
I really didn't know where to put this so hopefully this section works.

Anyway, I have been having a problem recently. I have Windows XP Pro, IIS 5 (I believe; whatever comes on Windows XP), newest stable version of both PHP and MySQL. When I view a page on my computer (localhost) the session don't work. The session variables are not carried over from the last page. Do I have a setting wrong? Is this a known problem.

I really am in a bind so anything would be helpful. Thanks!

Posted: Thu Dec 04, 2003 3:41 pm
by uberpolak
Do you have session_start(); at the top of every page?

Like this:

Code: Select all

<?php
session_start();
//rest of the code for that page
?>
If you do, and it's still not working, post some code, there could be other problems.

Posted: Thu Dec 04, 2003 6:18 pm
by partiallynothing
See, the weird thing is it works fine on my site (hosted by nexpoint), just not locally. Is there anything in the configuration front that may be wrong?

Posted: Thu Dec 04, 2003 7:24 pm
by microthick
in the php.ini you can configure it to auto start sessions. maybe that's not on on your local box.

session.save_path is missing from php.ini

Posted: Fri Dec 05, 2003 2:39 am
by dyconsulting
You are missing a directory where session info is stored. PHP will not create this directory structure automatically.

Your code is fine. All you have to do is open php.ini file and look for :
session.save_path. Change it to session.save_path=C:\PHP\sessiondata (provided you have created that folder first).

Re: session.save_path is missing from php.ini

Posted: Fri Dec 05, 2003 11:43 am
by JAM
dyconsulting wrote:You are missing a directory where session info is stored. PHP will not create this directory structure automatically.

Your code is fine. All you have to do is open php.ini file and look for :
session.save_path. Change it to session.save_path=C:\PHP\sessiondata (provided you have created that folder first).
Just wondering how you know that from the post above.

@partiallynothing:
"It doesn't work"; There can be 1-100's of reason for this. Could you paste error-messages (if any) and perhaps some code? Bump up the error level on yo localhost to E_ALL (max) just to be sure that you know that you are not supressing any errors generated...

Posted: Fri Dec 05, 2003 12:37 pm
by dyconsulting
Simple Watson:
He said that his code works in production. So this must be configuration issue on dev box. By default php install will not create session directory. Without this folder there is no way to store session data and this is why code breaks.