0

I know this has been posted before but none of the other answers worked for me. Here is my problem: I am making a login page for my website. I keep getting this error and I cant get rid of it:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/howto570/public_html/admin/index.php:1) in /home/howto570/public_html/admin/index.php on line 6

now here is the first bit of code

<?php

    $session_prefix = "henry_";
    $default_title = "Admin Panel";
    $folder_root = "/admin";
                session_start();
    require("../auth.php");
    $userdata = array();
?>

Even when I slash out all the other code like so:

<?php
session_start();
//$session_prefix = "henry_";
//$default_title = "Admin Panel";
//$folder_root = "/admin";

//require("../auth.php");
//$userdata = array();
?>

I still get the error.

So im at a loss not sure what to do, you can see the site itself here: www.howtotech.ca/admin/ . I dont know what to do.

Trevor Clarke
  • 1,482
  • 1
  • 11
  • 20

2 Answers2

0

From looking at your link, it looks like you are probably including this script in another script. There is HTML being outputted before your error message (ie. the head section). You can fix this by moving the session_start() to the top of the script that is including your script.

Tyler Marien
  • 752
  • 4
  • 11
0

This mostly happens because something is outputted before the session_start(). Even if you have single space before the starting of php remove it, the session_start should come before any output. If this doesn't work than most probably your editor can't see the blank space so you have to create a new file and paste the content in it.

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

Hope this helps you

Utkarsh Dixit
  • 4,267
  • 3
  • 15
  • 38