Solved

PHP Sessions on Windows

Posted on 2007-03-21
8
177 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

831 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