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

  • SEARCH
  • Home
  • 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 1019931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:05:24+00:00 2026-05-16T11:05:24+00:00

The relevant peice of code is below. According to php.net I have to make

  • 0

The relevant peice of code is below. According to php.net I have to make sure there is no output, not even any whitespace. There isn’t any. the php tag is the very first tag in the document no whitespace preceding it. What am I doing wrong?

<?php

    // main.php
    // 6:48 PM 8/6/2010

    include('config.php');

    // Does myid cookie exist?
    if ( !isset( $_COOKIE['myid'] ) )
    {
        // Generate myid
        $myid = substr(md5(date( 'Ymdhis' ) . str_replace( '.', '', $_SERVER['REMOTE_ADDR'] ) ), 0, 10);

        // set the cookie
        setcookie( 'myid', $myid, time() + 31536000 );
  • 1 1 Answer
  • 2 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-16T11:05:25+00:00Added an answer on May 16, 2026 at 11:05 am

    There needs to be no output at all before calling setcookie, even from other scripts.

    If config.php had whitespace before the opening <?php tag (or after the closing ?>), for example, that would cause the problem.

    Hunt down where header is called or some text outside of PHP tags (even whitespace) exists. That’s what’s happening, no doubt.

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

Sidebar

Related Questions

Here is the code relevant to my question: http://jsfiddle.net/mkerny45/V23NK/ As you can see there
Are there any relevant security issues in using a file cache (i.e. PEAR Cache_Lite)
I have the following piece of code (only relevant parts): xhttp=new XMLHttpRequest(); xhttp.open(GET,doc_name,false); xhttp.send();
We have a piece of code which saves a .Net System.Drawing.Bitmap to file. The
i'm not sure if i'm doing something wrong in my code or if my
I have a piece of C code as below which crashes at the calloc()
Relevant Code Snippet: public class MyPreference extends Preference { public MyPreference(Context context, AttributeSet attrs)
Here's the relevant code: <div data-bind=foreach: chats, visible: chats().length > 0> <input data-bind='value: $parent.newCommentText'
Here's the relevant code snippet. public static Territory[] assignTerri (Territory[] board, String[] colors) {
Here's the relevant code: public static void printBoarders (Territory x) { int t =

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.