php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25116 PHP can't find session, it starts the new session
Submitted: 2003-08-17 08:00 UTC Modified: 2003-08-19 10:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: leo dot jokinen at laurea dot fi Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.3.3RC5-dev OS: Windows XP home
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: leo dot jokinen at laurea dot fi
New email:
PHP Version: OS:

 

 [2003-08-17 08:00 UTC] leo dot jokinen at laurea dot fi
Description:
------------
My session.save_path contains these sessionfiles. Every time when i reload my page, the new file is being made. PHP won't find the current session. This problem happens also when is redirect my code into another php-file. I am running php with module of apache 1.3.28. 
Some stats: 
session.auto_start Off
session.bug_compat_42 On
session.bug_compat_warn On
session.cache_expire 180
session.cache_limiter nocache
session.cookie_domain no value
session.cookie_lifetime 0  
session.cookie_path / 
session.cookie_secure Off
session.entropy_file no value 
session.entropy_length 0  
session.gc_divisor 100 1
session.gc_maxlifetime 900 
session.gc_probability 1  
session.name PHPSESSID 
session.referer_check no value 
session.save_handler files 
session.save_path /Program Files/PHP/sessions/  
session.serialize_handler php  
session.use_cookies On 
session.use_only_cookies On 
session.use_trans_sid Off 



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-17 08:58 UTC] leo dot jokinen at laurea dot fi
I've tried to use these files to get access to the session.
page1.php:
<?php
session_start();
$_SESSION["test"] = "Hello World";
echo 'The content is '. $HTTP_SESSION_VARS['test'];
?>
<br><a href="page2.php">Next Page</a>

Page2.php:
<?php
session_start();
echo 'The content is '. $HTTP_SESSION_VARS['test'];
?>
<br><a href="page1.php">Previous Page</a>

If things would happening correctly, i would see the Hello World text also page 2. Instead the PHP makes second session-file, so it can't find correct one for my session.save_path directory.
 [2003-08-17 13:30 UTC] iliaa@php.net
Check if cookie is being sent and if it then is sent by the browser. You should also try to see if the code would work with URL sessions.
 [2003-08-18 10:03 UTC] leo dot jokinen at laurea dot fi
Now my page1 looks like this:
<?php
session_start();
$_SESSION["test"] = "Hello World";
echo 'The content is '. $HTTP_SESSION_VARS['test'];
?>
<br><a href="page2.php?<?php echo SID?>">Next Page</a>

Still doesn't work for me. I've tried a different browser (Mozilla) but nothing happened. =(
 [2003-08-18 10:34 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Works just fine here.

 [2003-08-18 14:07 UTC] leo dot jokinen at laurea dot fi
Thanks sniper! =) My php.ini was the fault.
Dunno what happened there but when i used that recommended ini, things starting to click.. Now the coding calls, thnx..
 [2003-08-18 23:56 UTC] leo dot jokinen at laurea dot fi
I was bit hasty for previous comment. Now my code works only when i use SID in the link. But for security reasons i want to pass the session id via cookie. I have this latest stable CVS snapshot. The only thing what i've changed is this line in php.ini:
session.save_path = "F:/Program Files/PHP/sessions/"

Here are the code what i am using now:
Page1.php
<?php
    session_start();
    $_SESSION['sess_var'] = "Hello world!";
    session_write_close();

    echo "The content is ". $_SESSION['sess_var']. "<br />";
?>
<a href="page2.php?<?php echo SID?>">Next page</a>

Page2.php
<?php
    session_start();

    echo "The content is ".$_SESSION['sess_var']."<br />";

    unset ($_SESSION['sess_var']);
    session_write_close();
?>
<a href="page1.php?<?php echo SID?>">First Page</a>
 [2003-08-19 02:58 UTC] sniper@php.net
I guess these still apply (check from phpinfo()!):

  session.use_cookies On 
  session.use_only_cookies On 
  session.use_trans_sid Off 

If so, we're back to the question: Is the cookie set at all? (easy way to check: set your browser to ask confirmation when cookie is about to be set)



 [2003-08-19 10:09 UTC] leo dot jokinen at laurea dot fi
The problem was ZoneAlarm Pro and maybe PHP's cookie settings, cause ZoneAlarm regonizes this (PHPSESSID) cookie for type "3rd party cookie". Why the cookie isn't type of session cookie like for example google-cookie? But thanks to Sniper (again :) for showing the way to the "bug"..
 [2003-08-19 10:11 UTC] derick@php.net
not a php bug -> bogus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 13:01:32 2024 UTC