note 90347 modified in function.setcookie by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:40:24 +0000 |
| Subject: | note 90347 modified in function.setcookie by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155011@lists.php.net to get a copy of this message | ||
Beware, the example below works fine on my testing server but didn't work on my providers
server;
<?php
setcookie("SessionID","a test cookie");
?>
Once the cookie is set my entire web site fails with messages
similar to.
"An appropriate representation of the requested resource could not be found on this
server."
I'd used similar code for years on another site, but where the value was numeric, I'd made
a minor change to generate a random string for the session ID and then got this issue.
The solution is not to use the cookie name "SessionID", i.e.
<?php
setcookie("SessionToken","a test cookie");
?>
works fine.
--was--
Beware, the example below works fine on my testing server but didn't work on my providers
server;
setcookie("SessionID","a test cookie");
Once the cookie is set my entire web site fails with messages
similar to.
"An appropriate representation of the requested resource could not be found on this
server."
I'd used similar code for years on another site, but where the value was numeric, I'd made
a minor change to generate a random string for the session ID and then got this issue.
The solution is not to use the cookie name "SessionID", i.e.
setcookie("SessionToken","a test cookie");
works fine.
http://php.net/manual/en/function.setcookie.php