Forum Moderators: coopster
This app is running on a apache 2 server with php 5.2x.
I'll try and keep this short, but it's a bit complicated (at least to me).
This application handles a backend connection to another site from mine so that the user stays on my site. It's been tested and runs fine on multiple sites across different hosts so the app itself is stable, but for some reason, I'm having a heck of a time getting it to function properly on my host.
The script creates a session and instead of saving it to the normal /tmp/ folder has assigned it's own path using the 'session_save_path' command.
The folder it is saving sessions to is at '777'
Initially, the script seemed as if it wasn't able to access the sessions once they were created so the process failed.
I noticed the script was under my user, but the session files showed as owned by nobody.
I asked my hosting support if this could be the problem and they said yes, so I began using php-cgiwrap so it would run under my user.
Now I no longer seem to be getting that error, but the script itself is still having a problem with the sessions. The sessions are being written as I can see them and they have the required info in them, but when the script tests for a valid session variable it fails the test.
So...what basically happens is..
file.php creates the session and stores it in the custom path.
(All session info is handled by a session.php file that is included at the top of any file that requires it's use.)
file2.php tests for a valid variable in the SESSION variable via!isset and fails.
The session is there, so what gives?
any thoughts?
Ok...I've been doing additional debugging/research and I've run into something that is likely the root cause of the issues, but I'm still not sure.
The app starts via a form submission using POST.
The main page tests the Server Request Method to make sure it is post, but for some reason, the Request Method is being changed to GET and an empty array.
After some research, it seems to be happening in the sessions.php file that uses the following code.
//Saves the sessions to a specific folder as defined in the config.php file.
$sessionSavePath = ConfigurationSettings::GetSessionSaveFolderFullPath();
ob_start();
session_save_path($sessionSavePath);
session_start();
If I place 'print_r($_POST);'anywhere in this file ABOVE 'ob_start();' it prints the POST variables perfectly.
If I place it anywhere AFTER ob_start(); the POST information is gone and has been replaced by an empty GET array.
Obviously this is causing issues, but I don't understand why this would be happening or how to stop it.
As mentioned, this application is running with no problems on a number of sites on many different hosts, so why is this causing a problem on this particular host?
check the different settings for
session.use_cookies [php.net]
session.use_only_cookies [php.net]
session.use_trans_sid [php.net]
One small setting in php.ini..."register globals = On"! Arrgggh.
Turned them off, which they should have been in the first place, and the app worked flawlessly as it should. I can't believe that mucked up the app so badly!
Now if only I could get back that 6 hours of debugging....*sigh*
[edited by: Philosopher at 2:28 pm (utc) on Jan. 15, 2008]
Since the app was working on other hosting accounts, I knew it had to be some type of config issue. Still weird though.
Oh well, thinks for trying to help. :)