Recently I have purchased a VDH package and need to be able to communicate between sub domain with the $_SESSION array. The system has been build with this is mind. I clarified that it was possible with the VDH service provide before purchase but they have not provided much help in accessing the situation.
I have done much research and following all advice given but cannot get it to work. I have a basic testing setup where one page will set the sessions variable and on another sub domain will output the session. The current result is that the session data is missing but the session ID is the same on bot test pages.
All the domains are on the same box.
Test file one
$session_name = session_name("er435536311993");
session_set_cookie_params(0, '/', '.mysite.com.au');
@session_start();
$_SESSION['this_is_test'] = 'This was set in the sub domain';
echo '<pre>';
var_export($_SESSION);
echo 'done';
var_export(session_id());
Test file two
$session_name = session_name("374WEaPW2me1392ZQWLM");
session_set_cookie_params(0, '/', '.whoadelaide.com.au');
@session_start();
echo '<pre>';
var_export($_SESSION);
var_export(session_id());
Some places have mentioned it may be a permissions error. I have access the httpd.conf file and adjusted the user and group permissions to be the same but still the data is not passed.
From what I can tell all the domains are accessing the same tmp space where the session date is being stored.
Support mentioned that I should disabled suPHP and Euexec to make it work. This did not change the outcome.
I cannot find the solution to my problem anywhere on the net. I have tried all possible solutions I can fine from variations in the PHP code to adjusting permissions.
I have tried some of the shell commands that people mentioned but they have not worked. CMD in the shell is not something that I'm familiar with. I have Putty set up and have tired a few thing via that.
Does anyone one have any ideas? Is there anything I can try? My client is
Why are you suppressing errors for
session_start()
? That's exactly where the errors are likely to appear.Remove the @ symbols and check your php error log.
Also, after the first test, find the session file in your filesystem and add the output of
ls -l <session file>
and the contents of that file to your question. If that doesn't solve your problem, do the same after the second test.Session files are usually in
/var/lib/php5/
but yours may be different. Check your php.ini if it isn't there.In the end I found a solution and it worked. I needed to disable suhosin within php. I'm not even sure what suhosin is but it worked.
Adding
At the end of the php.ini files sorted it out.