I have a 3-page order process I created for a client using my own website for initial development and testing. It is a Windows NT server with PHP 4.4.1 on it. When everything was working as desired, I copied it to my clients website -- which is Linux with PHP 5.2.4 on it. The problem now is that the $SESSION data is not recovered when moving from page to page. Within the same page the $SESSION data is recoverable but disappears as soon as the process moves to the next page. The following is what my debug codes shows while on the first page:
SESSION_NAME=PHPSESSID
SESSION_ID=85aab42b46e387d63b78bb17ed4b49b5
POST: Array
(
[FirstOrder] => YES
[PROD_CD_5_99] =>
[PROD_SS_5_99] =>
[PROD_WG_5_99] => 4
[TOTAL] => $23.96
[SubmitPage1] => CONTINUE
)
COOKIE: Array
(
[PHPSESSID] => 85aab42b46e387d63b78bb17ed4b49b5
)
SESSION: Array
(
[FirstOrder] => YES
[page1] => Array
(
[PROD_WG_5_99] => 4
)
)
This is what my debug code shows first thing on the next page -- note that the session cookie is present but the page 1 data is missing from the $_SESSION array:
SESSION_NAME=PHPSESSID
SESSION_ID=85aab42b46e387d63b78bb17ed4b49b5
GET: Array
(
)
COOKIE: Array
(
[PHPSESSID] => 85aab42b46e387d63b78bb17ed4b49b5
)
SESSION: Array
(
[page2] => Array
(
)
)
Lastly, in case you wonder, my debug code is an include file which looks like this:
<?php
echo '<pre>SESSION_NAME='.session_name()."\n";
echo 'SESSION_ID='.$_REQUEST[session_name()]."\n";
echo '</pre>'."\n";
//
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
echo '<pre>GET: ';
print_r($_GET);
echo '</pre>'."\n";
}else{
echo '<pre>POST: ';
print_r($_POST);
echo '</pre>'."\n";
}
//
echo '<pre>COOKIE: ';
print_r($_COOKIE);
echo '</pre>'."\n";
//
echo '<pre>SESSION: ';
print_r($_SESSION);
echo '</pre>'."\n";
?>
...and the beginning of page 2 looks like this:
<?php
if(!isset($_REQUEST[session_name()])
|| empty($_REQUEST[session_name()])):
if ($_SERVER['HTTPS'] == 'on'):
$url = 'https://';
else:
$url = 'http://';
endif;
$url = $url . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/order1.php';
header("Location: {$url}");
exit;
endif;
ini_set('url_rewriter.tags', ''); // Tells the URL rewriter not to change anything
ini_set('session.use_trans_sid', '0'); // Disables transparent SID support
ini_set('session.use_only_cookies', '1');
session_start();
Lastly, from phpinfo():
Directive Local Value Master Value
---------- ---------------- ----------------
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /var/php_sessions /var/php_sessions
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 1 1
Any ideas?