Page 1 of 1

Headers allready sent issue

Posted: Mon Mar 06, 2006 11:00 pm
by Jim_Bo
Hi, I have inserted the following code into the header page of the script:

Code: Select all

<?php ob_start(); session_start(); header("Cache-control: private"); ?>
followed by the rest if the code ie:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 

xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" 

content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" 

href="http://www.whatever.com/templates/style/site.css" />
<title><?php .......
I thought that ob_start() would clear the problem.

Any ideas, its been created in notepad.


Thanks

Posted: Mon Mar 06, 2006 11:02 pm
by Benjamin
Hello,

The has to be a space before your first <?php before ob_start();

Get rid of that and it will work.

Posted: Mon Mar 06, 2006 11:07 pm
by Jim_Bo
Hi have backspaced 100 times .. there is no whitespace presant that can be seen .. I have tried in notepad and dreamweaver ..

after trying to login i get:

Code: Select all

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/###/public_html/###/upload.html:753) in /home/fusion/public_html/###/templates/header.html on line 1
but prior to logging in its fine ..

Thanks

Posted: Mon Mar 06, 2006 11:07 pm
by nickman013
Here and for other refrence.

Read Jasons tutorial on the header function (it is based on that error).
:arrow: viewtopic.php?t=1157

Posted: Mon Mar 06, 2006 11:45 pm
by Jim_Bo
Yer I got a pretty good understanding how it works .. and i also know that ob_start normally fixes the the problem in this case.

I am 100% sure that there are no whitespaces unless they are hidden or something strange like that ..

Posted: Mon Mar 06, 2006 11:48 pm
by feyd
hint: the error tells you where the output started that caused it to happen.