Discussion:
Session_id(); are changing between the pages.
hadi
2014-06-07 17:07:45 UTC
Permalink
Hi,

session_id(); not passing the same id number to the second page in result
session file are created empty. Browser like IE and Chrome are not able to
pick up session variable.

I'm using PHP Version 5.3.25 on Linux CentOs.

Can someone Help me regards my issue.

My php code.

Page2.

<html>
<body>
<form action="test3.php" method="post">
Username: <br><input type="text" name="username"></br>
<input type="submit" name = 'submit1' value= 'Login'>
</form>
</body>
</html>

Page3.

<?php
session_start();
?>

<html>
<body>

<?php
$username = $_POST['username'];
$_SESSION['username']= $_POST['username'];
echo "<br> Hi $username.</br>";
?>

<form action="test4.php" method="post">
<input type="submit" name = 'submit' value= 'click me'>
</form>

</body>
</html>

Page4.

<?php
session_start();
$username = $_SESSION['username'];
echo "<br> Hi $username.</br>";
?>

Php.ini

Session Support enabled
Registered save handlers files user sqlite
Registered serializer handlers php php_binary

session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path /tmp /tmp
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0

Regards
-Hadi
Christoph Becker
2014-06-07 17:20:41 UTC
Permalink
hadi wrote:

> session_id(); not passing the same id number to the second page in result
> session file are created empty. Browser like IE and Chrome are not able to
> pick up session variable.

You should have a look at the HTTP headers, and check whether the
cookies are transferred to the browser (Set-Cookie) and whether they are
transferred back to the server (Cookie).

If the cookies are not transferred to the browser, have a look at your
error logs (assuming you have set error_reporting to an appropriate
value, what you should have on your developement machine anyway). There
may be something like "cannot sent headers; headers already sent".

--
Christoph M. Becker


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hadi
2014-06-07 21:38:24 UTC
Permalink
Christoph M. Becker,

I checked the browser (Set-Cookie) Cookie transferred to the browser but not
sending back to the server.

Also I enabled error_reporting ON, I'm getting this error at page4 after the
user click (click me) at page3 (Notice: Undefined index: username in
/var/www/html/phptest/test4.php on line 6)


hadi wrote:

> session_id(); not passing the same id number to the second page in
> result session file are created empty. Browser like IE and Chrome are
> not able to pick up session variable.

You should have a look at the HTTP headers, and check whether the cookies
are transferred to the browser (Set-Cookie) and whether they are transferred
back to the server (Cookie).

If the cookies are not transferred to the browser, have a look at your error
logs (assuming you have set error_reporting to an appropriate value, what
you should have on your developement machine anyway). There may be
something like "cannot sent headers; headers already sent".

--
Christoph M. Becker


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stuart Dallas
2014-06-07 21:51:07 UTC
Permalink
> On 7 Jun 2014, at 22:38, hadi <***@hotmail.com> wrote:
>
> I checked the browser (Set-Cookie) Cookie transferred to the browser but not
> sending back to the server.

Are you using localhost as your hostname? If so that’s why; cookies will not be stored against localhost. You need to either start using a hostname with at least on dot, or pass an empty string, null or false as the hostname when setting the cookie.

-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
hadi
2014-06-07 22:01:37 UTC
Permalink
Stuart,

> Are you using localhost as your hostname? If so that’s why; cookies will not
> be stored against localhost. You need to either start using a hostname with at
> least on dot, or pass an empty string, null or false as the hostname when
> setting the cookie.

Do you mean system name ? or hostname in php.ini ?

Here is my php.ini, please check it.

session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path /tmp /tmp
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0


> >
> > I checked the browser (Set-Cookie) Cookie transferred to the browser
> > but not sending back to the server.
>
> Are you using localhost as your hostname? If so that’s why; cookies will not
> be stored against localhost. You need to either start using a hostname with at
> least on dot, or pass an empty string, null or false as the hostname when
> setting the cookie.
>
> -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
Stuart Dallas
2014-06-07 22:21:43 UTC
Permalink
> On 7 Jun 2014, at 23:01, hadi <***@hotmail.com> wrote:
>
> Stuart,
>
>> Are you using localhost as your hostname? If so that’s why; cookies will not
>> be stored against localhost. You need to either start using a hostname with at
>> least on dot, or pass an empty string, null or false as the hostname when
>> setting the cookie.
>
> Do you mean system name ? or hostname in php.ini ?

Neither. When you visit your site in the browser are you using a URL that starts with http://localhost/ ?

-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
hadi
2014-06-07 22:38:19 UTC
Permalink
Stuart,

> Neither. When you visit your site in the browser are you using a URL that
> starts with http://localhost/ ?

No I'm using ip address http://192.168.206.129/phptest/test2.php

> >
> > Stuart,
> >
> >> Are you using localhost as your hostname? If so that’s why; cookies
> >> will not be stored against localhost. You need to either start using
> >> a hostname with at least on dot, or pass an empty string, null or
> >> false as the hostname when setting the cookie.
> >
> > Do you mean system name ? or hostname in php.ini ?
>
> Neither. When you visit your site in the browser are you using a URL that
> starts with http://localhost/ ?
>
> -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
Stuart Dallas
2014-06-07 23:24:19 UTC
Permalink
> On 7 Jun 2014, at 23:38, hadi <***@hotmail.com> wrote:
>
> Stuart,
>
>> Neither. When you visit your site in the browser are you using a URL that
>> starts with http://localhost/ ?
>
> No I'm using ip address http://192.168.206.129/phptest/test2.php

And you’re certain that cookies are enabled in your browser?

-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
Stuart Dallas
2014-06-07 23:28:23 UTC
Permalink
> On 8 Jun 2014, at 00:24, Stuart Dallas <***@3ft9.com> wrote:
>
>> On 7 Jun 2014, at 23:38, hadi <***@hotmail.com> wrote:
>>
>> Stuart,
>>
>>> Neither. When you visit your site in the browser are you using a URL that
>>> starts with http://localhost/ ?
>>
>> No I'm using ip address http://192.168.206.129/phptest/test2.php
>
> And you’re certain that cookies are enabled in your browser?

Your code works fine, so it must be something to do with your browser. My guess is that cookies are disabled.

http://dev.3ft9.com/php/hadi/test2.php

-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
hadi
2014-06-07 23:42:45 UTC
Permalink
Stuart,


> Your code works fine, so it must be something to do with your browser. My
> guess is that cookies are disabled.
>
> http://dev.3ft9.com/php/hadi/test2.php

I tried your link in my browser it work fine so cookie are enabled in my browser.

> >>
> >> Stuart,
> >>
> >>> Neither. When you visit your site in the browser are you using a URL
> >>> that starts with http://localhost/ ?
> >>
> >> No I'm using ip address http://192.168.206.129/phptest/test2.php
> >
> > And you’re certain that cookies are enabled in your browser?
>
> Your code works fine, so it must be something to do with your browser. My
> guess is that cookies are disabled.
>
> http://dev.3ft9.com/php/hadi/test2.php
>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
Aziz Saleh
2014-06-07 23:55:04 UTC
Permalink
On Sat, Jun 7, 2014 at 7:42 PM, hadi <***@hotmail.com> wrote:

>
> Stuart,
>
>
> > Your code works fine, so it must be something to do with your browser. My
> > guess is that cookies are disabled.
> >
> > http://dev.3ft9.com/php/hadi/test2.php
>
> I tried your link in my browser it work fine so cookie are enabled in my
> browser.
>
> > >>
> > >> Stuart,
> > >>
> > >>> Neither. When you visit your site in the browser are you using a URL
> > >>> that starts with http://localhost/ ?
> > >>
> > >> No I'm using ip address http://192.168.206.129/phptest/test2.php
> > >
> > > And you’re certain that cookies are enabled in your browser?
> >
> > Your code works fine, so it must be something to do with your browser. My
> > guess is that cookies are disabled.
> >
> > http://dev.3ft9.com/php/hadi/test2.php
> >
> > -Stuart
> >
> > --
> > Stuart Dallas
> > 3ft9 Ltd
> > http://3ft9.com/
>

What is the cookie value for PHPSESSID on each of those pages you have?
Aziz Saleh
2014-06-07 23:57:39 UTC
Permalink
On Sat, Jun 7, 2014 at 7:55 PM, Aziz Saleh <***@gmail.com> wrote:

>
>
>
> On Sat, Jun 7, 2014 at 7:42 PM, hadi <***@hotmail.com> wrote:
>
>>
>> Stuart,
>>
>>
>> > Your code works fine, so it must be something to do with your browser.
>> My
>> > guess is that cookies are disabled.
>> >
>> > http://dev.3ft9.com/php/hadi/test2.php
>>
>> I tried your link in my browser it work fine so cookie are enabled in my
>> browser.
>>
>> > >>
>> > >> Stuart,
>> > >>
>> > >>> Neither. When you visit your site in the browser are you using a URL
>> > >>> that starts with http://localhost/ ?
>> > >>
>> > >> No I'm using ip address http://192.168.206.129/phptest/test2.php
>> > >
>> > > And you’re certain that cookies are enabled in your browser?
>> >
>> > Your code works fine, so it must be something to do with your browser.
>> My
>> > guess is that cookies are disabled.
>> >
>> > http://dev.3ft9.com/php/hadi/test2.php
>> >
>> > -Stuart
>> >
>> > --
>> > Stuart Dallas
>> > 3ft9 Ltd
>> > http://3ft9.com/
>>
>
> What is the cookie value for PHPSESSID on each of those pages you have?
>

Also try accessing the test using http://localhost or 127.0.0.1 instead.
hadi
2014-06-08 00:29:16 UTC
Permalink
Aziz Saleh,

I tried accessing the system thru http://localhost and 127.0.0.1 but not working same error.

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

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

> >
> >>
> >> Stuart,
> >>
> >>
> >> > Your code works fine, so it must be something to do with your browser.
> >> My
> >> > guess is that cookies are disabled.
> >> >
> >> > http://dev.3ft9.com/php/hadi/test2.php
> >>
> >> I tried your link in my browser it work fine so cookie are enabled in
> >> my browser.
> >>
> >> > >>
> >> > >> Stuart,
> >> > >>
> >> > >>> Neither. When you visit your site in the browser are you using
> >> > >>> a URL that starts with http://localhost/ ?
> >> > >>
> >> > >> No I'm using ip address http://192.168.206.129/phptest/test2.php
> >> > >
> >> > > And you’re certain that cookies are enabled in your browser?
> >> >
> >> > Your code works fine, so it must be something to do with your browser.
> >> My
> >> > guess is that cookies are disabled.
> >> >
> >> > http://dev.3ft9.com/php/hadi/test2.php
> >> >
> >> > -Stuart
> >> >
> >> > --
> >> > Stuart Dallas
> >> > 3ft9 Ltd
> >> > http://3ft9.com/
> >>
> >
> > What is the cookie value for PHPSESSID on each of those pages you have?
> >
>
> Also try accessing the test using http://localhost or 127.0.0.1 instead.
hadi
2014-06-08 00:00:46 UTC
Permalink
Aziz Saleh,

> What is the cookie value for PHPSESSID on each of those pages you have?

I'm getting different value on each page, not the same value.

> >
> > Stuart,
> >
> >
> > > Your code works fine, so it must be something to do with your
> > > browser. My guess is that cookies are disabled.
> > >
> > > http://dev.3ft9.com/php/hadi/test2.php
> >
> > I tried your link in my browser it work fine so cookie are enabled in
> > my browser.
> >
> > > >>
> > > >> Stuart,
> > > >>
> > > >>> Neither. When you visit your site in the browser are you using a
> > > >>> URL that starts with http://localhost/ ?
> > > >>
> > > >> No I'm using ip address http://192.168.206.129/phptest/test2.php
> > > >
> > > > And you’re certain that cookies are enabled in your browser?
> > >
> > > Your code works fine, so it must be something to do with your
> > > browser. My guess is that cookies are disabled.
> > >
> > > http://dev.3ft9.com/php/hadi/test2.php
> > >
> > > -Stuart
> > >
> > > --
> > > Stuart Dallas
> > > 3ft9 Ltd
> > > http://3ft9.com/
> >
>
> What is the cookie value for PHPSESSID on each of those pages you have?
Stuart Dallas
2014-06-08 00:02:41 UTC
Permalink
> On 8 Jun 2014, at 01:00, hadi <***@hotmail.com> wrote:
>
> Aziz Saleh,
>
>> What is the cookie value for PHPSESSID on each of those pages you have?
>
> I'm getting different value on each page, not the same value.

This is because the browser is not sending the cookie back to the server, so the call to session_start() is creating a new session for each request.

-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
hadi
2014-06-07 23:29:43 UTC
Permalink
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.


> > Stuart,
> >
> >> Neither. When you visit your site in the browser are you using a URL
> >> that starts with http://localhost/ ?
> >
> > No I'm using ip address http://192.168.206.129/phptest/test2.php
>
> And you’re certain that cookies are enabled in your browser?
>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
Stuart Dallas
2014-06-07 23:35:38 UTC
Permalink
> On 8 Jun 2014, at 00:29, hadi <***@hotmail.com> wrote:
>
> 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
hadi
2014-06-07 23:55:54 UTC
Permalink
> 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
Stuart Dallas
2014-06-07 23:59:50 UTC
Permalink
> On 8 Jun 2014, at 00:55, hadi <***@hotmail.com> wrote:
>
>>
>> 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.

In that case your server is working fine, but your browser is not sending the cookie back to the server.

Try adding a hosts entry for the IP address, something like this:

192.168.206.129 site.local

Then try your scripts at http://site.local/phptest/test2.php

-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
hadi
2014-06-08 00:16:58 UTC
Permalink
Stuart,

> Try adding a hosts entry for the IP address, something like this:
>
> 192.168.206.129 site.local
>
> Then try your scripts at http://site.local/phptest/test2.php

Tried adding host entry in windows hosts file, but not luck same error.
http://x.hadi.com/phptest/test4.php

> >> 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.
>
> In that case your server is working fine, but your browser is not sending the
> cookie back to the server.
>
> Try adding a hosts entry for the IP address, something like this:
>
> 192.168.206.129 site.local
>
> Then try your scripts at http://site.local/phptest/test2.php
>
> -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
Stuart Dallas
2014-06-08 00:19:08 UTC
Permalink
> On 8 Jun 2014, at 01:16, hadi <***@hotmail.com> wrote:
>
> Stuart,
>
>> Try adding a hosts entry for the IP address, something like this:
>>
>> 192.168.206.129 site.local
>>
>> Then try your scripts at http://site.local/phptest/test2.php
>
> Tried adding host entry in windows hosts file, but not luck same error.
> http://x.hadi.com/phptest/test4.php

Show me the full Set-Cookie header(s) that are being sent when requesting test3.php.

-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
hadi
2014-06-08 00:42:28 UTC
Permalink
Stuart,

> Show me the full Set-Cookie header(s) that are being sent when requesting
> test3.php.

Requested headers:-

Key Value
Request POST /phptest/test3.php HTTP/1.1
Accept text/html, application/xhtml+xml, */*
Referer http://x.hadi.com/phptest/test2.php
Accept-Language en-US
User-Agent Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64;
Trident/6.0)
Content-Type application/x-www-form-urlencoded
Accept-Encoding gzip, deflate
Host x.hadi.com
Content-Length 27
DNT 1
Connection Keep-Alive
Cache-Control no-cache

Responds headers:-

Key Value
Response HTTP/1.1 200 OK
Date Sun, 08 Jun 2014 00:32:01 GMT
Server Apache/2.4.4 (Unix) OpenSSL/0.9.8e-fips-rhel5
PHP/5.3.25
X-Powered-By PHP/5.3.25
Set-Cookie PHPSESSID=a01h328drivti3aqhp1f5hog71; path=/tmp
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma no-cache
Content-Length 183
Keep-Alive timeout=5, max=100
Connection Keep-Alive
Content-Type text/html

Cookie :-

Direction Key Value
Expires Domain Path Secure HTTP only
Received PHPSESSID a01h328drivti3aqhp1f5hog71 At end of
session /tmp No No

> -----Original Message-----
> From: Stuart Dallas [mailto:***@3ft9.com]
> Sent: Sunday, June 08, 2014 3:19 AM
> To: hadi
> Cc: PHP General
> Subject: Re: [PHP] Re: Session_id(); are changing between the pages.
>
> > On 8 Jun 2014, at 01:16, hadi <***@hotmail.com> wrote:
> >
> > Stuart,
> >
> >> Try adding a hosts entry for the IP address, something like this:
> >>
> >> 192.168.206.129 site.local
> >>
> >> Then try your scripts at http://site.local/phptest/test2.php
> >
> > Tried adding host entry in windows hosts file, but not luck same error.
> > http://x.hadi.com/phptest/test4.php
>
> Show me the full Set-Cookie header(s) that are being sent when requesting
> test3.php.
>
> -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
Stuart Dallas
2014-06-08 00:53:32 UTC
Permalink
> On 8 Jun 2014, at 01:42, hadi <***@hotmail.com> wrote:
>
> Set-Cookie PHPSESSID=a01h328drivti3aqhp1f5hog71; path=/tmp

Bingo! Change session.cookie_path in your php.ini from /tmp to /. Sorry I didn’t look closer at your php.ini when you posted it earlier.

-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
hadi
2014-06-08 01:02:22 UTC
Permalink
Stuart,


> Bingo! Change session.cookie_path in your php.ini from /tmp to /. Sorry I
> didn’t look closer at your php.ini when you posted it earlier.

It work thank you.

I have a other error when I click back button in my browser it give me (Webpage has expired)
Any clue why this happing ?

> > Set-Cookie PHPSESSID=a01h328drivti3aqhp1f5hog71; path=/tmp
>
> Bingo! Change session.cookie_path in your php.ini from /tmp to /. Sorry I
> didn’t look closer at your php.ini when you posted it earlier.
>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
Ashley Sheridan
2014-06-08 08:56:52 UTC
Permalink
On Sun, 2014-06-08 at 04:02 +0300, hadi wrote:
> Stuart,
>
>
> > Bingo! Change session.cookie_path in your php.ini from /tmp to /. Sorry I
> > didn’t look closer at your php.ini when you posted it earlier.
>
> It work thank you.
>
> I have a other error when I click back button in my browser it give me (Webpage has expired)
> Any clue why this happing ?
>
> > > Set-Cookie PHPSESSID=a01h328drivti3aqhp1f5hog71; path=/tmp
> >
> > Bingo! Change session.cookie_path in your php.ini from /tmp to /. Sorry I
> > didn’t look closer at your php.ini when you posted it earlier.
> >
> > -Stuart
> >
> > --
> > Stuart Dallas
> > 3ft9 Ltd
> > http://3ft9.com/

That usually happens when you've sent POST data to a page, which should
be used to change state on the server. Your browser is recognising this
and informing you (in its own little way) that this is something you
might not want to do.

--
Thanks,
Ash
http://www.ashleysheridan.co.uk




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hadi
2014-06-08 21:39:12 UTC
Permalink
Ash,

> That usually happens when you've sent POST data to a page, which should be
> used to change state on the server. Your browser is recognising this and
> informing you (in its own little way) that this is something you might not want
> to do.

I couldn't understand your answer. I'm facing trouble here, when I click back button in my browser I get this error (Webpage has expired).
Can you help here regard this issue.

My php.ini

Session Support enabled
Registered save handlers files user sqlite
Registered serializer handlers php php_binary

session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path /tmp /tmp
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0

> -----Original Message-----
> From: Ashley Sheridan [mailto:***@ashleysheridan.co.uk]
> Sent: Sunday, June 08, 2014 11:57 AM
> To: hadi
> Cc: 'Stuart Dallas'; 'PHP General'
> Subject: Re: [PHP] Re: Session_id(); are changing between the pages.
>
> On Sun, 2014-06-08 at 04:02 +0300, hadi wrote:
> > Stuart,
> >
> >
> > > Bingo! Change session.cookie_path in your php.ini from /tmp to /.
> > > Sorry I didn’t look closer at your php.ini when you posted it earlier.
> >
> > It work thank you.
> >
> > I have a other error when I click back button in my browser it give
> > me (Webpage has expired) Any clue why this happing ?
> >
> > > > Set-Cookie PHPSESSID=a01h328drivti3aqhp1f5hog71; path=/tmp
> > >
> > > Bingo! Change session.cookie_path in your php.ini from /tmp to /.
> > > Sorry I didn’t look closer at your php.ini when you posted it earlier.
> > >
> > > -Stuart
> > >
> > > --
> > > Stuart Dallas
> > > 3ft9 Ltd
> > > http://3ft9.com/
>
> That usually happens when you've sent POST data to a page, which should be
> used to change state on the server. Your browser is recognising this and
> informing you (in its own little way) that this is something you might not want
> to do.
>
> --
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
Aziz Saleh
2014-06-08 22:38:41 UTC
Permalink
On Sun, Jun 8, 2014 at 5:39 PM, hadi <***@hotmail.com> wrote:

> Ash,
>
> > That usually happens when you've sent POST data to a page, which should
> be
> > used to change state on the server. Your browser is recognising this and
> > informing you (in its own little way) that this is something you might
> not want
> > to do.
>
> I couldn't understand your answer. I'm facing trouble here, when I click
> back button in my browser I get this error (Webpage has expired).
> Can you help here regard this issue.
>
> My php.ini
>
> Session Support enabled
> Registered save handlers files user sqlite
> Registered serializer handlers php php_binary
>
> session.auto_start Off Off
> session.bug_compat_42 Off Off
> session.bug_compat_warn Off Off
> session.cache_expire 180 180
> session.cache_limiter nocache nocache
> session.cookie_domain no value no value
> session.cookie_httponly Off Off
> session.cookie_lifetime 0 0
> session.cookie_path /tmp /tmp
> session.cookie_secure Off Off
> session.entropy_file no value no value
> session.entropy_length 0 0
> session.gc_divisor 1000 1000
> session.gc_maxlifetime 1440 1440
> session.gc_probability 1 1
> session.hash_bits_per_character 5 5
> session.hash_function 0 0
> session.name PHPSESSID PHPSESSID
> session.referer_check no value no value
> session.save_handler files files
> session.save_path /tmp /tmp
> session.serialize_handler php php
> session.use_cookies On On
> session.use_only_cookies On On
> session.use_trans_sid 0 0
>
> > -----Original Message-----
> > From: Ashley Sheridan [mailto:***@ashleysheridan.co.uk]
> > Sent: Sunday, June 08, 2014 11:57 AM
> > To: hadi
> > Cc: 'Stuart Dallas'; 'PHP General'
> > Subject: Re: [PHP] Re: Session_id(); are changing between the pages.
> >
> > On Sun, 2014-06-08 at 04:02 +0300, hadi wrote:
> > > Stuart,
> > >
> > >
> > > > Bingo! Change session.cookie_path in your php.ini from /tmp to /.
> > > > Sorry I didn’t look closer at your php.ini when you posted it
> earlier.
> > >
> > > It work thank you.
> > >
> > > I have a other error when I click back button in my browser it give
> > > me (Webpage has expired) Any clue why this happing ?
> > >
> > > > > Set-Cookie PHPSESSID=a01h328drivti3aqhp1f5hog71; path=/tmp
> > > >
> > > > Bingo! Change session.cookie_path in your php.ini from /tmp to /.
> > > > Sorry I didn’t look closer at your php.ini when you posted it
> earlier.
> > > >
> > > > -Stuart
> > > >
> > > > --
> > > > Stuart Dallas
> > > > 3ft9 Ltd
> > > > http://3ft9.com/
> >
> > That usually happens when you've sent POST data to a page, which should
> be
> > used to change state on the server. Your browser is recognising this and
> > informing you (in its own little way) that this is something you might
> not want
> > to do.
> >
> > --
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
It would be best to keep this in the new thread (giving its a new question).
Loading...