|
Posted by radoo on 08/17/06 06:39
You don't have to make corrections on server for this. Is not the
server's fault. You're the one who's using the headers in the wrong
way. The output buffering allows to open only one channel to the
browser to output the data from the server.
For example:
1. The following script is not correct
<html>
<body>
<?php
if ($_POST['skipthispage']==1){
header("Location: nextpage.php");
}
?>
</body>
</html>
When the php proc is getting to html tags it automatically opens the
output to the browser. Thus the php function header which always opens
the output buffering can not open the channel to the browser. The same
goes to many other functions that opens outputs to the browser (like
when deleting or setting cookies).
So the solution is to use all these functions before opening the output
to the browser.
Sonia Covarrubias wrote:
> Hello :) I am new to PHP and am having one particular problem which has been
> repeatedly causing me trouble..
>
> I've manually installed on my winXP machine apache2 and php4. For some
> reason all my headers give me the error "WARNING, headers already sent
> by..." common error it seems.. so, I cannot run headers, cookies, sessions..
> etc..
>
> I've been reading and searching, and i've come up with 2 solutions..
> 1. there are extra carriage returns somewhere which are causing this.
> 2. change output_buffering to "On" in PHP.ini.
>
> using #2 worked.. but it according to many it is the wrong solution...
> Well.. i've gone through the session files i'm experimenting with.. no extra
> spaces anywhere.. and i've looked through PHP.ini line by line.. deleted
> every single extra space using Windows Notepad.. and still, the same headers
> error when output_buffering is at it's default "Off"...
>
> Any ideas? all I hear is delete extra spaces.. doesn't seem to work for me..
> or am I missing something?
> any help is greatly appreciated..
>
> thanks ;)
Navigation:
[Reply to this message]
|