php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30880 $_SESSION problem - values not being passed
Submitted: 2004-11-24 13:47 UTC Modified: 2004-11-25 23:01 UTC
From: steven dot harrison3 at ntlworld dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: Irrelevant OS: windows xp pro
Private report: No CVE-ID: None
 [2004-11-24 13:47 UTC] steven dot harrison3 at ntlworld dot com
Description:
------------
I?m using EasyPHP1-7 from http://www.easyphp.org/ (this has php 4.3.3, apache server 1.3.27 and MySql but I?m using a Firbird database for this project).
I have a windows xp professional operating system(with service pack 2) and am trying to develop a php website on my local machine.

I have changed the Php.ini file to : 
?	session.save_path = C:\EasyPHP1-7\temp\ to enable session variables.
?	php_interbase.dll enabled in easyPHP to connect to Firebird database.


Now my problem is that the $_SESSION superglobals are not keeping their value to the next page.
?	I?ve looked in the C:\EasyPHP1-7\temp\ folder and it seems to create two files ? one with the information from the first php page then a new one with nothing in it for the second page, therefore losing the value I want. 
?	Now I know that session start() will create a new session if an existing one does not exist, .
?	I have checked my php info and session variables are enabled, I?ve even created a privay policy header to see if this was the problem. (found at www.privacycouncil.com )

Has anyone any ideas as I?ve inherited this site as a final year project and it uses these superglobals a lot for database connection and user logins and the university won?t host session variables through php.


I've included an incredibly simple php page that won't work but should.
Any suggestions would be gratefully accepted as I'm a newby to these session variables.



Reproduce code:
---------------
//1st php page:
<?php
Header("P3P:CP='NON CUR OUR IND UNI STA OTC'")
?>
<?php

session_start();
?>
<html>
<head>
<title> Starting or resuming a session</title>
</head>
<body>
<?php
echo "<p> Your session ID is ".session_id()."</p>";


 
$_SESSION[product1] = "sonic screwdriver";
echo "The products have been registered ";
echo $_SESSION[product1];
echo "<br>";
echo session_save_path();

?>
<p>&nbsp;</p>
<p><a href="/_mmServerScripts/session3.php">session3</a></p>
</body>
</html>

//second page
<?php
Header("P3P:CP='NON CUR OUR IND UNI STA OTC'")
?>

<?php

if (!session_id())
{
  session_start();
}

?>
<html>
<head>
<title> Starting or resuming a session</title>
</head>
<body>
<?php
echo "<p> Your session ID is ".session_id()."</p>";

$product = $_SESSION[product1];
echo "your chosen product is: ";
echo "<br>";
echo "$product";
echo "<br>";
echo "humph!";

?>
</body>
</html>


Expected result:
----------------
your chosen product is:
sonic screwdriver
humph!

Actual result:
--------------
your chosen product is:

humph!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-25 23:01 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You need to enable session.use_cookies and/or session.use_trans_sid in your php.ini. 
This is definitely not PHP problem, even taking into account that you PHP version is extremely old.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 17:01:30 2024 UTC