Solved

PHP Sessions on Windows

Posted on 2007-03-21
8
183 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

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.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

615 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