Dear All,
Recently I wrote a login page and works fine on the Window OS, however the same script does not work in the Linux (FEDORA), Apache/2.0.52. The session is not available in different pages, I assume that I should do some kind of setting ether php.ini or some Apache system configuration but I don't know, please help and thanks in advance.
Here is the script that does not work as intended:
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$SESSION['favcolor'] = 'green';
$SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
echo '<br /><a href="page2.php">page 2</a>';
?>
<?php
// page2.php
session_start();
echo 'Welcome to page #2<br />';
echo "<p>".$SESSION['favcolor']; // green
echo "<p>".$SESSION['animal']; // cat
echo "<p>".date('Y m d H:i:s', $_SESSION['time']);
echo '<br /><a href="page1.php">page 1</a>';
?>
Not desired output:
Welcome to page #2
1970 01 01 01:00:00