RE: Re: Session_id(); are changing between the pages.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> If you’re not getting something equivalent to that then there’s something
> wrong with your browsers, or there is something between you and the
> server that’s stripping cookie headers. If you are getting that and it’s still not
> working you need to check to make sure your PHP processes can write to
> /tmp. In fact it’s probably worth looking in /tmp on the server to see if there
> are PHP session files in there.
 
When I look in the server /tmp directory I found tow session file one for page3 with name inside it, and the second for page4 but its empty with different cookie header.

I test php process can read/write to /tmp directory with the Following code.
In result I get 

s9ff5hevqpel71kp9inhjgbvq0
Notice: Undefined index: username in /var/www/html/phptest/test4.php on line 6

 Hi .
41777 php-umask: 22 exec-umask: 0022

<?php
session_start();
echo session_id();
ini_set('display_errors', true);
error_reporting(E_ALL);
$username = $_SESSION['username'];
echo "<br> Hi $username.</br>";

$s = stat('/tmp');
printf('%o', $s[2]);
file_put_contents('/tmp/phptest1234.txt', 'test');
unlink('/tmp/phptest1234.txt');

echo ' php-umask: ', sprintf('%o', umask()), "\n";
echo ' exec-umask: ', exec('umask'), "\n";



?>

> >
> > Stuart,
> >
> >> And you’re certain that cookies are enabled in your browser?
> >
> > Yes im sure cookie enabled in my browser in fact im using three browsers IE
> and Chrome, Firefox, for testing.
> 
> When I use your code, test3.php responds with a Set-Cookie header:
> 
> Set-Cookie: PHPSESSID=3b19d9302e3c09019b3e295ca20aeea2; path=/
> 
> When I click the button to go to test4.php, my browser (Chrome) sends this
> Cookie header:
> 
> Cookie: PHPSESSID=3b19d9302e3c09019b3e295ca20aeea2
> 
> If you’re not getting something equivalent to that then there’s something
> wrong with your browsers, or there is something between you and the
> server that’s stripping cookie headers. If you are getting that and it’s still not
> working you need to check to make sure your PHP processes can write to
> /tmp. In fact it’s probably worth looking in /tmp on the server to see if there
> are PHP session files in there.
> 
> -Stuart
> 
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php

<<attachment: smime.p7s>>


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux