Forum Moderators: coopster

Message Too Old, No Replies

Header information

         

FnTm

9:17 pm on Oct 23, 2007 (gmt 0)

10+ Year Member



Hi!

Ive got this problem:
When I run my page, it outputs this:

Warning: Cannot modify header information - headers already sent by (output started at \htdocs\LJO\sec\login.php:34) in \htdocs\LJO\sec\login.php on line 35

and line 35 is:

 header('Location: ../index.php');

Anyone?

Thanks.

d40sithui

9:27 pm on Oct 23, 2007 (gmt 0)

10+ Year Member



maybe you have some output before header(). check to make sure you don't. if this is not the case, post ur script up to line 35 so we can take a better look.

dreamcatcher

2:00 pm on Oct 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From PHP.net:

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

dc

FnTm

9:36 am on Oct 26, 2007 (gmt 0)

10+ Year Member



heres my code:


<meta http-equiv="Content-Type" content="text/html; charset=windows-1257">
<?php

session_start();

echo "<table border='1'><tr><td>";
//include "sec/registered.php";
echo "</td><td>duck all!</td>";
echo "<td>";
//include "ievade.php";
echo "</td>";
//session_close();
?>

Ive commented all of the includes out, so nothing should be taken from those files.

and it still gives me:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\xampp\htdocs\LJO\index.php:2) in D:\xampp\htdocs\LJO\index.php on line 4
duck all!

And heres the page source:


<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1257"><script charset="utf-8" id="injection_graph_func" src="chrome://skype_ff_toolbar_win/content/injection_graph_func.js"></script></head><body><br>
<b>Warning</b>: session_start() [<a href="function.session-start">function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at D:\xampp\htdocs\LJO\index.php:2) in <b>D:\xampp\htdocs\LJO\index.php</b> on line <b>4</b><br>
<table border="1"><tbody><tr><td></td><td>duck all!</td><td></td></tr></tbody></table></body></html>

Im totally lost here. Started working with sessions just recently, and until this, ive been ok.

dwighty

10:12 am on Oct 26, 2007 (gmt 0)

10+ Year Member



Hi FnTm,

You will need to start your sessions before outputting any content.

so if:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1257">
<?php

session_start();

Is at the top of your file then change it to:
<?php
session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257">