Reputation: 23873
As a newcomer to PHP, I need to get $_SESSION variables working as part of a larger project. I am finding that the I cannot transfer data between .php files using $_SESSION variables. I Googled for similar problems and found this solved problem.Same problem
I reduced my code to the exact same as the solution to the problem, but it still exists. I have
sesstest.php
<?php
session_start();
$_SESSION['test']="TEST SESSION TEXT";
header('location:sessreceive.php');
?>
sessreceive.php
<?php session_start();
echo $_SESSION['test'];
?>
I have cookies enabled and it is the same in Firefox and IE. The site I'm accessing is a Raspberry Pi on my home network. It is running Apache2 under a Linux version. The session part of my php.ini is
Could anyone please suggest what might be wrong, as I get no output in sessreceive.php?
Upvotes: 1
Views: 1737
Reputation: 11985
Can try var_dump($_SESSION);
, to see what exactly it contains.
Also, try echo session_id();
in both cases to ensure you're picking up the same session in both cases.
Make sure Apache can write to the session.save_path
(/var/lib/php5
)
Upvotes: 0
Reputation: 42
Make sure that the session.save_path
exists. Sometimes that is the problem.
Upvotes: 1