View Full Version : Php Errors
Brywright 10-10-2004, 07:27 AM Hi ive almost finished my new site but keep getting this error spammed in cpanel error logs
[error] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/bry/public_html/index.php:7) in /home/bry/public_html/ns/rmenu.php on line 4
index.php
<HTML>
<HEAD>
<LINK rel="stylesheet" type="text/css" href="ns/style.css">
</HEAD>
<BODY >
<script>
var myimages=new Array()
............
<script> = line 7
-------------------------
rmenu.php
<center><?php require '/home/bry/public_html/ns/sympoll/booth.php';
newest_booth(); ?> <br>
</center>
<?php virtual("/cgi-bin/pquery/pquery.pl?s=195.149.21.203:27015") ?><br>
<SPAN class="nav_section">Forums</SPAN>
........
<?php virtual("/cgi-bin/pquery/pquery.pl?s=195.149.21.203:27015") ?><br> = line 4
--------------------------
ive done a seach for this problem and alot of people say to check for blank lines and stuff ive double checked and their r 0 blank lines.
Does anyone know how to solve this? its not a major problem but it is spamming my error log
Many thanks
jasong 10-10-2004, 12:09 PM <BODY >
<script>
is that not a blank line?
i
Brywright 10-10-2004, 12:19 PM oops must of added that somehow.
Getting same error just line number changes
<HTML>
<HEAD>
<LINK rel="stylesheet" type="text/css" href="ns/style.css">
</HEAD>
<BODY > <!--bkground colour of site-->
<script>
----------
[error] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/bry/public_html/index.php:6) in /home/bry/public_html/ns/rmenu.php on line 4
line 6= <script>
excelblue 10-10-2004, 01:43 PM You need to move the <?php ?> stuff to before anything HTML is sent.
xxtyderxx 10-10-2004, 07:42 PM maybe it needs to be </script> ??
Brywright 10-11-2004, 05:04 AM Originally posted by excelblue
You need to move the <?php ?> stuff to before anything HTML is sent.
thxs
but how do i do that. I needs to appear in specific places in my page. So i dunno how to move it about while keeping thigns appearing correctly...
thartdyke 10-11-2004, 07:09 AM You will find that either the page you are including (booth.php) or the function newbooth() (or both) are sending headers. the offending piece of code must appear before you send any HTML.
If you can't separate out the bit that sends headers from some other page output, then you need to rewrite your code.
Brywright 10-11-2004, 07:21 AM no i dont think its that for i remove it and i get the same error but this time relating to line 1 which is now
<?php virtual("/cgi-bin/pquery/pquery.pl?s=195.149.21.203:27015") ?><br>
thartdyke 10-11-2004, 07:36 AM From the PHP help file:
Virtual returns the HTTP entity header after the requested file, when it's the first output to the page.
The work-around to prevent seeing the header is, of course, to output something (such as echo " "; ) before calling virtual.
Could that be your problem?
Brywright 10-11-2004, 07:49 AM that could well be it many thanks :)
so my code for taht part would look like
<?php
echo " ";
virtual("/cgi-bin/pquery/pquery.pl?s=195.149.21.203:27015") ?><br>
?
thartdyke 10-11-2004, 07:52 AM Put a semicolon after virtual(...) and the <br> may be unnecessary, but otherwise yes.
Brywright 10-11-2004, 07:56 AM cheers i changed it to
<?php
echo " ";
virtual("/cgi-bin/pquery/pquery.pl?s=195.149.21.203:27015"); ?>
however it is still complaining :(
(output started at /home/bry/public_html/index.php:6) in /home/bry/public_html/ns/rmenu.php on line 6
line 6 is still the virtual line
thartdyke 10-11-2004, 08:02 AM What are lines 1,2 and 3?
Brywright 10-11-2004, 08:15 AM <center><?php require '/home/bry/public_html/ns/sympoll/booth.php';
newest_booth(); ?> <br>
</center>
thartdyke 10-11-2004, 09:21 AM You can't output any HTML at all before headers are sent. are booth.php and newest_booth outpuuting any HTML? I would assume they are. The call to the virtual() function must happen before any HTML is sent.
From the PHP help:
Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header.
In other words, what you are doing with virtual() will generate headers, so has to be sent out before any HTML.
Brywright 10-11-2004, 03:11 PM thanks for your help. I really dont want to have the server display above the poll. So i'll guess ill have to put up witht he errors.
Thanks for your help its been appreciated
|