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 8998771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:04:49+00:00 2026-06-16T00:04:49+00:00

Possible Duplicate: Headers already sent by PHP I’m having a problem with session_start() and

  • 0

Possible Duplicate:
Headers already sent by PHP

I’m having a problem with session_start() and header('Location:') on a log out php file.

I’m linking to the log out file using a simple anchor tag from a html file. The logout php file is this:

<?php
session_start();
session_destroy();
header("Location: index.php");
?> 

To see where the errors where I used,

error_reporting(E_ALL);
ini_set('display_errors', '1');

I got a warning that “Warning: session_start(): Cannot send session cache limiter – headers already sent” on line 4 (where session_start(); is) and Warning: Cannot modify header information – headers already sent on line 6 (where header('Location') is).

I’ve had a look around for others who have had similar problems. I’ve made sure there’s no whitespace before the session_start(). Nothing is being outputted before it. I’ve tried only setting session_start() if it’s not already set. I’ve tried buffering it with ob_start(). I tried a relative and absolute path for the redirect just to make sure. But nothing has worked.

Am I missing something? Any help is much appreciated.

  • 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-06-16T00:04:50+00:00Added an answer on June 16, 2026 at 12:04 am

    check out BOM

    http://en.wikipedia.org/wiki/Byte_order_mark

    in notepad++ – encoding -> utf8 without BOM

    EDIT

    just to comment – you should use exit; after header(“Location…”) to make sure nothing else will run, as recommended in http://php.net/manual/en/function.header.php

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

Sidebar

Related Questions

Possible Duplicate: PHP error: Cannot modify header information – headers already sent I've built
Possible Duplicate: Headers already sent by PHP My problem is that I have a
Possible Duplicate: PHP error: Cannot modify header information – headers already sent I have
Possible Duplicate: PHP error: Cannot modify header information – headers already sent Hi I
Possible Duplicates: PHP headers already sent PHP session_start() error? What does this error mean?
Possible Duplicate: Warning: Headers already sent in PHP When I create my php files
Possible Duplicate: php headers already sent error I have attached my code which am
Possible Duplicate: PHP headers already sent So I just joined Hostgator.com, and was wondering,
Possible Duplicate: “Warning: Cannot modify header information - headers already sent by” error In
Possible Duplicate: Headers already sent by PHP The following code in PHP gives the

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.