Session variables not saved

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Webbrewer
Forum Newbie
Posts: 2
Joined: Thu Feb 03, 2005 4:39 pm

Session variables not saved

Post by Webbrewer »

I am having a problem with session variables. When I run a test program as simple as:
<?php
session_start();
$_SESSION['test'] = "test";
?>
The variable gets saved when the script is run from the command line, but the sess_ file is empty when the same script is run from a browser. This worked before, but something changed to cause it to no longer save to disk. It seems that Apache might be the culprit but I have no idea how to troubleshoot this.
wyred
Forum Commoner
Posts: 86
Joined: Mon Dec 20, 2004 1:59 am
Location: Singapore

Post by wyred »

Sounds like a permissions problem to me. Running your script from the command line gives you the same permissions as the person who logged into the server.

Running the script from the browser gives you lesser privileges.

Check the folder that stores the sess_ files to see if the permissions have been correctly configured.
Webbrewer
Forum Newbie
Posts: 2
Joined: Thu Feb 03, 2005 4:39 pm

Post by Webbrewer »

The folder owner and group is set to apache. I tried giving the folder full global priveleges, but that didn't help...
wyred wrote:Sounds like a permissions problem to me. Running your script from the command line gives you the same permissions as the person who logged into the server.

Running the script from the browser gives you lesser privileges.

Check the folder that stores the sess_ files to see if the permissions have been correctly configured.
Post Reply