RE: [PHP] Re: Session_id(); are changing between the pages.
| From: | hadi | Date: | Sat, 07 Jun 2014 23:55:54 +0000 |
| Subject: | RE: [PHP] Re: Session_id(); are changing between the pages. | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323412@lists.php.net to get a copy of this message | ||
> 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: [application/pkcs7-signature] smime.p7s
Attachment: [application/pkcs7-signature] smime.p7s