Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at index.php:3) index.php on line 3

I have tried this a number of ways but I am unable to fix this

<?php
ob_start();
session_start();

And this

<?php
session_start();
ob_start();

And like this

<? ob_start(); ?>
<?php
session_start();

Any help would be very much apprciated, I have the same type of code on a different website working perfectly...

Recommended Answers

All 4 Replies

I have just uploaded a new blank php file -

<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Title</title>
</head>
<body class="animated" data-animated="fadeIn">

</body>
</html>

And I am still getting the same error message...

I have different websites using the same type of code on the same hosting account without any problems...

This is not driving me insane.... HELP...SOMEONE...PLEASE

there is no session set, so it is going to return false.

<?php 
    include('file_that_contains_connect_and_registers_cookie);
    session_start();
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.