View Full Version : session_start();

11-13-2007, 05:14 PM
I'm having a problem with one of my files. I keep on getting the following error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/user/public_html/index.php:8) in /home/user/public_html/nmdeluxe/index.php on line 2

The second line of the nmdeluxe/index.php file has the session_start(); code. There aren't any spaces before the <?php line. The file is in ANSI form. I'm also including this file in one of my other files using PHP includes.

<? include("/home/user/public_html/nmdeluxe/index.php") ?>

The public_html/index.php has that code in it. The nmdeluxe/index.php does include itself into the public_html/index.php file, but I that error message appears at the top of the page. How can I fix this?

11-13-2007, 05:50 PM
From the error message - output started at ... public_html/index.php:8.

Post your main index.php, something at or before line 8 is outputting content to the browser.

11-13-2007, 06:08 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<title>title of website</title>

<meta name="keywords" content="a, bunch, of, keywords">

That goes up to line 8.

11-13-2007, 06:12 PM
All of that is content that is output to the browser. You must execute a session_start() on any page that uses sessions prior to any content being output to the browser.

11-13-2007, 06:36 PM
So I need to add in a <?php session_start(); ?> at the beginning of my public_html/index.php file?

11-13-2007, 06:46 PM