moldboy 0 Report post Posted June 5, 2005 I am trying to learn PHP and was wondering what is wrong with the tutorals on this site:http://forums.xisto.com/no_longer_exists/I copied the code between the body tages in my site, and am returned with an error regarding headers. Does anybody why this is? Share this post Link to post Share on other sites
fffanatics 0 Report post Posted June 5, 2005 Delete the blank line before the <?php tag. This should fix your header errors because once anything is written to the browser, php cannot edit header information of the page like the location and such. Most likely they just didnt use the code tag correctly when posting the tutorial on that website Share this post Link to post Share on other sites
moldboy 0 Report post Posted June 5, 2005 Okay I think I know what you mean about blank lines. So this is what my code looks like (the php is from the second page) <html><head><title></title></head><body bgcolor="#FFFFFF"><?php Header("Content-type: image/png"); $height = 300; $width = 300; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 10,110,100); $white = ImageColorAllocate($im, 255, 255, 255); ImageFill($im, 0, 0, $bck); ImageLine($im, 0, 0, $width, $height, $white); for($i=0;$i<=299;$i=$i+10) { ImageLine($im, 0, $i, $width, $height, $white); } ImagePNG($im); ?></body></html>but I still get a header error, says there is something wrong with line 7.Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html/phptest/php2.php:6) in /home/moldboy/public_html/phptest/php2.php on line 7Could it be the way the GD tool set is set up on Xisto? Share this post Link to post Share on other sites
ashiezai 0 Report post Posted June 5, 2005 hi there .. i've always seen this problem ... always got a header error ... but i do not know the cause of it .. but i might have a solution to it ... It happens that whenever i changed my file content online ... i will get a header error on my php file that i edited ... so i tried to edit them offline and upload them .. and no more header error ... this works for me .. may be you can try this out ... just do everything offline on your computer .. and upload the final file to the server Do let me know if this works Share this post Link to post Share on other sites
HmmZ 0 Report post Posted June 5, 2005 no what you have to do, is always with headers like this and session_start() is put them in the very top of your page, so the first thing in your script should be: <?phpsession_start();Header("Content-type: image/png"); ?><html>//your html...in your script you dont need session_start, so take it off and you got your fix, it's a must for php scripts to have these kinda things at the very top, else it causes 'cannot modify header- headers already sent' errors Share this post Link to post Share on other sites
hype 0 Report post Posted June 6, 2005 You can try making a backup files and edit it offline... I often have this error and usually edit the backup files in my harddisk then upload it to my server... That's saves everything... Or maybe you can clear your cache... Share this post Link to post Share on other sites