php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24239 setcookie() not functioning
Submitted: 2003-06-17 23:47 UTC Modified: 2003-06-18 22:34 UTC
From: mcratt at itctel dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.2 OS: Redhat Linux 2.4.18-3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mcratt at itctel dot com
New email:
PHP Version: OS:

 

 [2003-06-17 23:47 UTC] mcratt at itctel dot com
Description:
------------
Using PHP 4.3.2 CGI:

setcookie() fails to set a cookie.

OS: Redhat Linux 2.4.18
Apache Version: 1.3.27
Configure Command =>  './configure' '--prefix=/usr/local' '--with-apache=../../apache_1.3.27' '--enable-exif' '--enable-track-vars' '--with-calendar=shared' '--enable-magic-quotes' '--enable-trans-sid' '--enable-wddx' '--enable-ftp' '--enable-inline-optimization' '--enable-memory-limit' '--with-gd=/usr/local' '--with-zlib' '--enable-gd-native-tt' '--with-t1lib=/usr/local' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-ttf' '--with-freetype-dir=/usr/local' '--with-mhash=/usr/local' '--with-mcrypt=/usr/local' '--with-pdflib=/usr/local' '--with-tiff-dir=/usr' '--with-jpeg-dir=/usr' '--with-zlib-dir=/usr' '--with-openssl=/usr' '--with-curl=/usr' '--with-ldap'



Reproduce code:
---------------
#!/usr/bin/php
<?php
setcookie("name","value",0,"/",".mydomain.com");
echo "Content-type: text/html";
echo "You should now have a cookie.";
?>

Expected result:
----------------
I expect that the cookie warning feature of my web browser would alert me to an incoming cookie.

Actual result:
--------------
No cookie alert is triggered nor is one written when setting a 'persitent' cookie.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-18 13:11 UTC] sniper@php.net
Why do you run PHP scripts under Apache which is configured with PHP by using CLI? (wild guess, but using PHP CGI setcookie works fine here)

Configure Apache/PHP correctly and it will work.

Ask further support questions elsewhere, here is no bug.

 [2003-06-18 22:34 UTC] mcratt at itctel dot com
My apologies to the PHP team. There is always one more thing to check before something is really a bug. As sniper guessed, apache was pointing to the CLI binary.

Thank you for your time and efforts.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC