moldboy
Jun 5 2005, 03:59 AM
| | I am trying to learn PHP and was wondering what is wrong with the tutorals on this site: http://www.phpfreaks.com/tutorials/105/1.php I copied the code between the body tages in my site, and am returned with an error regarding headers. Does anybody why this is? |
Reply
fffanatics
Jun 5 2005, 04:43 AM
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
Reply
MarCrush
Jun 5 2005, 04:47 AM
QUOTE(fffanatics @ Jun 4 2005, 09:43 PM) 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 Always make sure there are no blank lines before the <?php because that can cause problems espically on includes. Always remember this as this can be useful for editing phpBB files and other PHP files as well.
Reply
moldboy
Jun 5 2005, 03:59 PM
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) CODE <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. QUOTE 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 7
Could it be the way the GD tool set is set up on trap17?
Reply
ashiezai
Jun 5 2005, 04:17 PM
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
Reply
HmmZ
Jun 5 2005, 05:49 PM
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: CODE <?php session_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
Reply
hype
Jun 6 2005, 05:29 AM
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...
Reply
Recent Queries:--
php5 imagecreate tutorial - 217.08 hr back. (1)
Similar Topics
Keywords : php, gd, im, problems
- Php Problems
Clan Web site Problem (3)
Problems With Data Formatting
(2) I have a MySQL database which stores articles. A sample article would look like this: CODE This
is a body. This is a body.This is a body.This is a body.This is a body.This is a body.This is a
body.This is a body.This is a body.This is a body.This is a body.This is a body.This is a body.This
is a body.This is a body.This is a body.This is a body. This is a body.This is a body.This is a
body.This is a body.This is a body.This is a body.This is a body.This is a body.This is a body.This
is a body.This is a body.This is a body.This is a body.This is a body. That'....
Problems With Php
(5) Recently, my system was infected by a Trojan Horse. Since then, I've been finding files missing
and now my PHP will not work, my Apache server will not display PHP files, i've tried getting
rid of the files in my C:\Windows and C:\Windows\system32 folders but nothing is
working. (it comes up with 'file in use') All help greatly appreciated.....
Preg_replace Problems
(7) Sigh... preg_replace is getting very annoying for me. Could sombody tell me what I'm doing
wrong? Im making a bbcode replace for the forums I made, and preg_replace is being a b****...
Right now Im working on the tag, and I want to check for valid URL's, because idiots in the
forum are adding js and stuff in the image tags and messing it all up. So i put a function in the
array that holds all of the replacements: CODE
$main_search=array('/\[b\](.*?)\[\/b\]
/is','/\[i\ ....
Mysql Authentication Problems
(11) I installed the new version of both php and mysql on my computer and I am trying to work on a
database. The problem is the following. Even though I have the latest version of both php and mysql,
and I have created users in the new mysql version, I still get the problem that I get an error
message about authentication problems. I have no clue what I am doing wrong. It did work for a short
period of time, but somehow it is no longer working. Is there anyone who has a tutorial on how to
install both php and mysql? I have the feeling that there are a lot of settings in my.in....
Odbc Form Problems
(0) Hy everyone! I am moderately familiar
with PHP and have been using it for a couple years for various different things.
Basic information about my system:
PHP 5 MySQL 4.1 Apache Windows XP Pro I'm using
PHP/MySQL for a web-based server and have an ODBC set up in my office. I'm running into some
problems using the ODBC code as opposed to the MySQL code in some scripts I ha....
Phpnuke Newsletter Sending Problems
(0) i have a problem sending newsletters....when i send them no1 receives it...i tried sending to the
registered users on my site which im in and i didnt recieve it in my mail...i dont know why this is
happening...it says the newsletter is sent...but we get nothing in our mail... heres the code
QUOTE /************************************************************************/ /* PHP-NUKE:
Web Portal System */ /* ===========================
*/ /* ....
Major Problems With Php Script
Hold on for this one! (8) Okay, so I got a php script for my site called php Bible. So I get it and go to install it, and
then the problems start. You see it uses php, dud, to search and view scripture. So here are the
instructions: QUOTE 1) Upload the files to a useful place inside your web server's
document tree. 2) Change the things that look wrong in config.php. 3) Make sure "AcceptPathInfo
ON" (or analogous) is somewhere in your PHP file section of your web server config. 4) Go over
steps 2 and 3 again, because you probably missed something for lack of documentation. So....
Include Funtion Php Problems
in xammp and php 5.1.1 (11) Hi, I just recently installed the latest versin of XAMMP on my computer which comes with php5.1.1
and i have been noticing some problems with the include(); funtion. This is a code that worked
fine on trap17 hosting so I am thinking it has something to do with the php version of 5.1.1 since
trap17 uses 4.3.X. Now what the actual problem is is using the variables in the include function.
If i have a normal include sentence like this one: CODE include "hello.php"; then it
works fine but as soon as i start using variables it somehow dosent work at all. ....
Problems With Php Form?
Can you please help? (7) I am trying to install a PHP form. I am using a tutorial I found in the tutorials section. It was
really good, but I have a few problems. Here is the link, if you need it:
http://www.trap17.com/forums/index.php?sho...ic=8118&hl=form Anyway, so I place the mailform.php
in an html document on file manager right? So I do that. And I put it in the body: CODE
<?php $Name = $_POST['Name']; $Subject =
$_POST['Subject']; $Email = $_POST['Email'];
$Site = $_POST['Sit....
<? Include ?> Problems
(4) Well, I'm new to PHP, and I get tons of problems when I use the include tags: Let's say my
site is www.mysite.com, and the menu is www.mysite.com/menu.htm. The site I want to include menu.htm
in is not in the same folder as menu.htm, but in "folder2": www.mysite.com/folder2/index.php The
images in menu.htm are located in it's own folder: www.mysite.com/images. However, when I load
index.php with , the images won't load. Then I try to check the image location and it says that
the images that didn't load was located in www.mysite.com/folder2/images ....
Browser Problems, Maybe?
Firefox vs IE (6) Alright, I coded something the other day for the game I am working on making, and a few of my
friends I allowed to get on it and test things out. Well....the ones that were on IE their
characters were made but the User variable as in which account they were on just stayed blank, while
with my friends that were on Firefox, everything worked fine and they could play perfectly... So I
was wondering, with PHP sql codes being sent to the database, is there something special you have to
do to make it work on both, or could it be a setting on the IE that was messing with it......
Postnuke Install Problems On Subdomains
(1) I'm trying to install PostNuke on a empty server I allready got PostNuke downloaded and uploaded
the downloaded files to the server but I can't get it to work. I'm trying to do this on 2
servers both are sub-domains and both support php. One of them has a MySQL database and MyAdmin but
I can't find them anywhere on the sub-domain. I'm pretty new to this and any advise would be
more then welcome to me. I tryed looking for a MySQL database to install but when I do I get
something like 30 different versions and don't know whitch one I need I tryed th....
Problems With Apostrophes [ ' ] In Php
(4) Yes I have another problem. I have a blog that I made with php and mysql. It's working just
fine except for the text being displayed on the page. Everytime there's an apostrophe
encountered, *something puts a slash before it. It's fine in the database only the page.
Probably a problem with PHP. I hope you understand what I say. Here's a sample line displayed
in my blog: -- It\'s Saturday but I\'m still in the office. -- ....
Ftp Script Problems - Authentication Failure
(3) I uploaded the code as a text file because it's pretty big: http://beeseven.trap17.com/ftp.txt
As I said it can't login. I get this error: Warning : ftp_login(): Authentication failed,
sorry in /home/beeseven/public_html/ftp.php on line 45 I think it might have something to do
with character encoding, but I'm not sure. If you think it is, what kind of encoding would work
as if I typed it directly? I tried putting it in the file, but then I got the missing required
fields error.....
Mysql Relational Problems
(3) didn't know where to post this but since I build this database with php, I post it here. I have
to build a relational database 4 a school project. Made a webbased interface and made a database
with primary&foreign keys and not null fields to preserve the integrety of my database. -When I
insert an empty field or I just don't give the field where the field has the property NOT NULL
it just fills in nothing or some default value (it ignores the not null property). -When I insert 2
rows with the same primary key in the same table it doesn't throw an error but ....
Looking for php, gd, im, problems
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for php, gd, im, problems
*MORE FROM TRAP17.COM*
|
advertisement
|
|