#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Ekaterinburg, Ural, Russia
    Posts
    10
    Rep Power
    0
    Hello, thank you for reading this!

    I'm using PHP + Apache + Linux.
    I'm trying to set a cookie with setcookie();
    function.
    And I get this message:
    Warning: Oops, php3_SetCookie called after header has been sent in /.../cookies.php3 on line 12

    I tried to embed setcookie(); into <head></head>
    but the result was the same.
    So how could I solve the problem? Does it mean that Apache is sending HTTP header
    before I try to send cookie?

    Thank you a prioiri.

    Cheers,
    =Thistle=
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    21
    Rep Power
    0
    setcookie(), or header() must come befor *anything* is sent to the client. Make sure the first thing your script sends to the client is the setcookie request. Not even blank lines can be sent.

    Check the php.net manual section on setcookie and header for more info. There are some minor differences between php4 and php3 when it comes to this, mainly the headers are sent in reverse order in php3



    ------------------
    - theFinn
    http://www.totalgeek.org
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Pune, Maharashtra, India
    Posts
    86
    Rep Power
    14
    You must try to give setccokie() function before ur <html> tags even inside a <?php brackets. Hope this will solve ur problem.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Ekaterinburg, Ural, Russia
    Posts
    10
    Rep Power
    0
    Thank you!
    Your answers did solve the problem.
    And now I get no warning.

    Cheers,
    =Thistle=

  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Ekaterinburg, Ural, Russia
    Posts
    10
    Rep Power
    0
    theFinn and nikunj -
    Thank you!
    Your answers did solve the problem.
    And now I get no warning.

    Cheers,
    =Thistle=

Similar Threads

  1. Linux C/C++ winsock & thread question
    By beholder242 in forum C Programming
    Replies: 3
    Last Post: January 28th, 2004, 06:31 AM
  2. Function question about a while loop
    By rkelley in forum PHP Development
    Replies: 3
    Last Post: January 26th, 2004, 12:56 AM
  3. PHP data retrieval question with MySQL
    By gursharn in forum PHP Development
    Replies: 7
    Last Post: December 31st, 2003, 09:43 AM
  4. Javascript question mark question?
    By tajmiester in forum JavaScript Development
    Replies: 3
    Last Post: November 30th, 2003, 05:36 PM
  5. Radio Buttons
    By Ulysses Freeman in forum HTML Programming
    Replies: 4
    Last Post: November 15th, 2003, 09:57 PM

IMN logo majestic logo threadwatch logo seochat tools logo