Page 1 of 1

Sessions and IIS -Issues with passing between 2 pages[FIXED]

Posted: Wed Mar 14, 2007 6:01 am
by phpdevuk
Hello,
I have been working on a relatively simple webpage which uses sessions to handle things like login. On my test server here on win 2k running wamp, and on my linux hosting online it runs fine. As soon as I upload to the clients win2003 hosting php 4.3.4 all sessions fail to persist across pages.
I originally looked at phpinfo to check session variables and discovered after a bit that the php temp directory was not writable, I believed changing this would have solved the problem but it did not.
I also tried passing the SID manually to see if this would work, but again with no success.
Having tried about everyway I can think of to set a session $_SESSION, session_register, but all to no avail.
About the only thing I have found that works was another website which had code for php3 session legacy stuff in it, this involves a long seris of manually setting all the session variables. I have tried this on my code but still with no success (I think it would take me a week to decipher whats going on in that file).
I have read some of the posts here on the same subject, but so far have already tried everything which worked for other people. The hosting guy is being about as much help as a wet towel too seeming to be convinced that the problem is linux specific code in phpmailer class.
So I guess my question is can anyone think of any obvious problems that I may have missed?

Posted: Wed Mar 14, 2007 6:43 am
by volka
please try

Code: Select all

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
session_start();

if ( !isset($_SESSION['test']) || !is_array($_SESSION['test']) ) {
	$_SESSION['test'] = array();
}

$_SESSION['test'][] = date('H:i:s');
?>
<html>
	<head>
		<title>session test</title>
	</head>
	<body>
		<a href="<?php basename($_SERVER['SCRIPT_NAME']); ?>">reload</a><br />
		name: <?php echo session_name(); ?><br />
		id: <?php echo session_id(); ?><br />
		<pre>cookies: <?php var_export($_COOKIE); ?></pre>
		<pre>session: <?php var_export($_SESSION); ?></pre>
	</body>
</html>
and use the link to reload the page several times.
a) is the value of id: chaning?
b) does it print more than one element after session: ?
c) are there any error/warning/notice messages?

Posted: Wed Mar 14, 2007 7:01 am
by phpdevuk
tried that script and interestingly I get the old can't write to sessions folder again. ID stays the same, but its obviously not creating sessions files.
I have temporarily solved the problem by storing session in a mysql database for now.
Thanks for the help.