Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP Sessions on Windows

Posted on 2007-03-21
8
Medium Priority
?
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

670 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