0

Take a look at the following 2 pieces of code:

test.php:

<?
session_start();
$_SESSION['test'] = 'TEST SESSION';
header('location:receive.php');
?>

receive.php

<? 
session_start();
echo $_SESSION['test'];
?>

When I run in the browser test.php, it redirects me to receive.php, but the following warning is displayed:

Notice: Undefined index: test in /var/www/html/sessreceive.php on line 2

In other words, $_SESSION is not coming with 'test', as it should.

I've been trying whole day to find a solution to this, but no luck. I saw many issues related to 'session.save_path', but mine is set, folder writable and it seems to work - I can see session files being created under my specified tmp folder.

I am working on a VPS so I am able to check anything. But still facing the problem.

PS: This is a simple example - my real problem is with one Prestashop installation that is hanging in step 2 - and searching over the internet, that was the reason - sessions are not good.

Any help would be much appreciated.

CristiC
  • 22,068
  • 12
  • 57
  • 89
  • 2
    There is a good checklist: http://stackoverflow.com/a/19692734/4382892 – Marc Apr 03 '15 at 18:11
  • @Marc: That looks like duplicate. Instead of directing OP to it with a comment, feel free to vote to close as duplicate. – Cᴏʀʏ Apr 03 '15 at 18:14
  • Try with $HTTP_SESSION_VARS; if its working, check your register_globals config in your php.ini :) – iguypouf Apr 03 '15 at 18:14
  • Found the reason for this - I had Varnish installed and that was giving the problem. Btw - the checklist did not helped in this case (as I already checked it before asking the question). – CristiC Apr 08 '15 at 16:13

0 Answers0