Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 911959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:17:55+00:00 2026-05-15T17:17:55+00:00

while reading about cookies i found difficulty to grasp the following statement setcookie() must

  • 0

while reading about cookies i found difficulty to grasp the following statement
“setcookie() must be called before any output to the HTTP response. The main reason is that PHP is not buffering the HTTP response”
please help me to interpret it in easy way

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:17:55+00:00Added an answer on May 15, 2026 at 5:17 pm

    To understand that statement, you need to know a few things:

    1. HTTP responses consist of two parts, a set of “headers” (key-value pairs) and then the “body” which is the actual data e.g. a web page or image.
    2. HTTP headers have to be sent first, and once even one byte of the “body” has been sent, no more headers will be processed by the client.
    3. Cookies, among other things, are sent to the client in the form of HTTP headers.

    So what it’s saying is: unless you do something special, the instant you “echo” something or have any data outside a <?...?> block, PHP will begin the response body with that data. After that point, no more headers, including cookie-setting headers, can be sent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While reading about binary semaphore and mutex I found the following difference: Both can
While reading about mcv3 I came across an attribute name called [ActionName] . It
While reading about constant interface antipattern, i found final constant class with no instances
while reading about declare construct from php manual i tried the following example using
I was reading about Empty Base Optimization(EBO). While reading, the following questions popped up
While reading from Bruce Eckel's Thinking in C++ about namespaces, I encountered the following
While reading Jack Shirazi's 'Java performance tuning', I came across the following statement: Instance
I just recently found out about Flyway and while reading and searching about it
I came across the following while reading about how easy it is to redefine
While reading about Google webtool kit, came across a statement saying 'synchronous RPCs are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.