Jump to content

Cookies not writing/reading correctly.


lex1000

Recommended Posts

I have 2 linux/apachie boxes with php 5 (php 5.2 and php5.2.5 respetively). On the first box I'm having trouble with cookies. I've put the bellow script onto both boxes:-

 

<?php

$value = 'something from somewhere';

setcookie("TestCookie", $value);

echo print_r($_COOKIE);

?>

 

and then called the script with a linux curl command:

 

curl -D/tmp/a --cookie cook1=123 http://url

 

The first box returns:

Array

(

    [cook1] => 123

)

and /tmp/a hold:

HTTP/1.1 200 OK

Date: Thu, 03 Apr 2008 17:23:36 GMT

Server: Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8a DAV/2 PHP/5.2.5

X-Powered-By: PHP/5.2.5

Set-Cookie: TestCookie=something+from+somewhere

Cache-Control: max-age=2592000

Expires: Sat, 03 May 2008 17:23:36 GMT

Content-Length: 30

Content-Type: text/html

 

 

The second box returns:

Array

(

    [cook1] =>

)

 

with a /tmp/a:

HTTP/1.1 200 OK

Date: Thu, 03 Apr 2008 17:26:08 GMT

Server: Apache/2.2.3 (Linux/SUSE)

X-Powered-By: PHP/5.2.0

Set-Cookie: TestCookie=binA0BsoCiwoulYVvgCOfrYtc7qytKhPBtwIvbRrcyfeF9WqDpjT9fvVs0BN0DcP

Content-Length: 27

Content-Type: text/html

 

Has anybody got any idea what could be going on with the second box?

 

Thanks for any help.

 

Lex.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/99391-cookies-not-writingreading-correctly/
Share on other sites

We've now managed to resolve this issue. For anybody who is having a similar problem and ends up here from their search, the problem was with suhosin encryption (http://www.hardened-php.net/suhosin/configuration.html#suhosin.cookie.encrypt). I turned off the cookie, and session encryption and Bobs-ya-Monkhouse.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.