Solved

PHP Sessions on Windows

Posted on 2007-03-21
8
181 Views
Last Modified: 2008-03-06
Loaded PHP 4.4.4 onto a Windows 2003 Web Edition Server.  All php functions work fine, except for session variables.  Smae code works fine on other servers, so I assume its a php.ini setting.  Looked and chagned everything I could find, but still cant get session variable to resolve.

code works like:
set session variable
redirect to new page
retreive session variable

Always come up empty on the Windows servers.  Any ideas where the php.ini setting is that would cause this.  Keep in mind, I do not beleive this to be a page scripting problem since it works fine when on a unix machine with PHP.
0
Comment
Question by:mopar003
  • 4
  • 4
8 Comments
 
LVL 3

Expert Comment

by:exoska
ID: 18767030
you might have already checked out but,
  session_start();

is the key to use(set/get) the session variables.
at the very top of the page..
0
 
LVL 1

Author Comment

by:mopar003
ID: 18767145
first two lines of every page are:

session_start();
ob_start();

any other ideas?  I can post a link to a phpinfo() page as well if needed.
0
 
LVL 3

Expert Comment

by:exoska
ID: 18767202
after checking that the php.ini file is the one you are touching,
in the ini file,
please check session.save_path is pointing a true folder.
and for a crash test, set that folders security settings to "everyone" and try again..
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:exoska
ID: 18767207
also, restart iis after the change.. don t remember if the restart is a must at such a change though.
0
 
LVL 1

Author Comment

by:mopar003
ID: 18767279
save_path is going to a true folder, and a session file is being written, although empty.  Access for everyone is full.  Still no success.
0
 
LVL 3

Accepted Solution

by:
exoska earned 250 total points
ID: 18767422
http://bugs.php.net/bug.php?id=16263

many quotes like "I get empty sess_ files in /tmp"

looks like a bug still unsolved.. but one thing worth trying

session.save_path = "0;c:\<<your session var path>>"
don't forget to use the 0; before the path.

on the page there are some other solutions to try ..

hope it helps



0
 
LVL 1

Author Comment

by:mopar003
ID: 18781569
Still ahving the same issue.  Tried all the suggestions on the linked page above, and still no success.  have also tried different versions of PHP as well, all to no avail.  This seems to be specific to the Windows PHP.  *nix platform works fine.  I also took the phpinfo() from both windows and unix and did a side by side comparison adn matched them up as best I could.  

This seems to be a fairly common problem.
0
 
LVL 1

Author Comment

by:mopar003
ID: 18785243
session_write_close()

All it took!  For whatver reason, I have to close out the session before any header redirects or it loses the info.  Thats not quite right.  If I take out the header redirects, and just do a one line echo, it worked fine.  Not sure why, but I added the session_write_close() before the ehader redirect and then everything worked.  Thanks for the info.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding additional variables to key => value association 17 37
xml with php question 5 30
CURL sending XML without spaces PHP 5 30
MySQL-Design Help 12 40
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question