Solved

PHP Sessions on Windows

Posted on 2007-03-21
8
172 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
 
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mail Not Sent 6 42
Wordpress syntax error 1 28
Send current WordPress page in a URL parameter 3 34
windows 10 bash shell 4 34
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now