I have not worked with php for some time and came back to one of my projects just to find out that the session variable is not stored. It came like a surprise, because the last time I checked, it worked and I have not used php (therefore has not changed the code or config).
The situation is as follows: session is not stored across the pages (I can save it and it shows the same on the page, but when I refresh - nothing changes).
I looked here PHP Session data not being saved and replicated the example:
<?php
session_start();
if(isset($_SESSION['views']))
$_SESSION['views'] = $_SESSION['views']+ 1;
else
$_SESSION['views'] = 1;
echo "views = ". $_SESSION['views'];
echo '<p><a href="page1.php">Refresh</a></p>';
but nothing changes: I still has views = 1.
Nevertheless I have not changed my config, but I still looked at phpinfo():
I checked my permissions to write to the folder /tmp - they are ok, moreover after each refresh a new file appears there.
Then I checked the work in other browsers: and to my surprise it works in firefox: the number correctly increases there.
So the situation: in chrome it does not work, in firefox it works. I use chrome as default. I also remember playing with chrome options when it switches to blink, but as far as I remember I changed back everything.
Any idea how I can fix php sessions in chrome?
P.S:
- cookies are enabled in chrome
- sessions files are in /tmp I tried to delete them all and when later I refresh the page in chrome - the new file appears
- in headers I am sending Cookie:PHPSESSID=mystring but no session id