[solved] Session Variables not working
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Feyd,
Hi here is the results of the output of the code you gave me:
Does that tell us anything?
Rob.
Hi here is the results of the output of the code you gave me:
Code: Select all
PHP Version: 4.3.2-RC2
PHP OS: WINNT
Error Reporting: 2047 (E_ALL)
Register Globals: On
Short Tags: On
Display Errors: OffRob.
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Everah here are the results of your tests..........
test.php:
test2.php
Confused? Yes I am !
Rob.
test.php:
Code: Select all
ROB is the value set for "test".
Our current session id is 00e6b5525f41a6b04e0dbcfcea719526
Try the testCode: Select all
is the value set for "test".
Our current session id is 00e6b5525f41a6b04e0dbcfcea719526Rob.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
That is odd. It seems to be keeping some session data but not other data.
That means sessions are working. But why they would not be working on your variables is confusing.
Is this portion of code executing after an include or other code that could potentially unset or reset the session var?
EDIT: OOhh, maybe something else you can try... On your first test page set like four or five session vars. On the second of the two test which values you have using a for each loop...
See what that throws at you.
Is this portion of code executing after an include or other code that could potentially unset or reset the session var?
EDIT: OOhh, maybe something else you can try... On your first test page set like four or five session vars. On the second of the two test which values you have using a for each loop...
Code: Select all
<?php
foreach ($_SESSION as $key => $value)
{
echo $key . ' is the session key and ' . $value . ' is its value.<br />';
}
?>-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
OK, run the test that I added to my last post. If that does nothing post the full code of both pages. Also, try running a stripped down version ofthe two pages for testing, making sure to write them fresh (not reusing any code from the two current pages). And try clearing your cache again to make sure you are seeing the freshest page renders.
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Jcart | Please use
2:
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Here is my code exactly as it is in the files, the 2nd page displays nothing just a white screen......
1:Code: Select all
<?php
session_start();
$_SESSION['test1']="ROB";
$_SESSION['test2']="ROB";
$_SESSION['test3']="ROB";
$_SESSION['test4']="ROB";
$_SESSION['test5']="ROB";
$_SESSION['test6']="ROB";
echo $_SESSION['test1'] . ' is the value set for "test1".<br />';
echo $_SESSION['test2'] . ' is the value set for "test2".<br />';
echo $_SESSION['test3'] . ' is the value set for "test3".<br />';
echo $_SESSION['test4'] . ' is the value set for "test4".<br />';
echo $_SESSION['test5'] . ' is the value set for "test5".<br />';
echo $_SESSION['test6'] . ' is the value set for "test6".<br />';
echo 'Our current session id is ' . session_id() . '<br />';
echo '<a href="test2.php">Try the test</a>';
?>2:
Code: Select all
<?php
session_start();
foreach ($_SESSION as $key => $value)
{
echo $key . ' is the session key and ' . $value . ' is its value.<br />';
}
?>Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Change the second page to this:
Then clear the cache and run the second page again by way of a link from the first page. See what that does.
Code: Select all
<?php
ini_set('error_reporting', E_ALL);
session_start();
foreach ($_SESSION as $key => $value)
{
echo $key . ' is the session key and ' . $value . ' is its value.<br />';
}
?>-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Hi,
I posted the 2nd script exactly as you said and I still get a blank white screen........
You can test and view the source here:
http://www.first4glass.net/test1.php
This is very odd!
Rob.
I posted the 2nd script exactly as you said and I still get a blank white screen........
You can test and view the source here:
http://www.first4glass.net/test1.php
This is very odd!
Rob.
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Ok maybe we are getting some where now........
Here is the error log:
Rob.
Here is the error log:
Code: Select all
[Wed Apr 12 08:46:44 2006] [error] PHP Warning: session_start(): open(/tmp\sess_d509fff503b0bca31d6d115b91e81725, O_RDWR) failed: No such file or directory (2) in d:\software\apache\htdocs\first4glass\test1.php on line 2
[Wed Apr 12 08:46:44 2006] [error] PHP Warning: Unknown(): open(/tmp\sess_d509fff503b0bca31d6d115b91e81725, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
[Wed Apr 12 08:46:44 2006] [error] PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm