php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16342 can not set cookie with domain specified
Submitted: 2002-03-29 07:36 UTC Modified: 2002-06-12 14:51 UTC
From: myaddress at iname dot com Assigned:
Status: Closed Package: HTTP related
PHP Version: 4.1.1 OS: cookies and domain
Private report: No CVE-ID: None
 [2002-03-29 07:36 UTC] myaddress at iname dot com
If I specify a domain, cookie is not set:

This works:
$exp = time()+120;
setcookie ("TestCookie", "TEST$exp",$exp);

This doesn't work:
$exp = time()+120;
setcookie ("TestCookie", "TEST$exp",$exp, "/", "www.domain.com");

Doesn't set a cookie at all. Any ideas?



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-13 18:52 UTC] shiflett@php.net
Try this:

setcookie("test_cookie", "test$exp", $exp, "/", ".domain.com");

Also, don't forget that you can just write your own header with the header() function. If, for some reason, there *is* a problem with setcookie(), you can always just write your own to be sure.

If my above example doesn't fix the problem, please try to give me the HTTP traffic, specifically the response. If you're unsure how to do this, feel free to email me personally.

Hope that helps.

Chris
 [2002-06-12 14:51 UTC] shiflett@php.net
It's been 60 days without a response. Please reopen this bug if it still persists. Otherwise, I will assume my last comment resolved it for you.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 20 11:01:30 2019 UTC