Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP script not working! Headers already set?

Status
Not open for further replies.

1gbram

Technical User
Jul 1, 2006
69
GB
I'v set a small web site where people can download scripts, it's currently in it's early days but I'm already habing problems!
THe Web site is goto script and then Php download, there you can find the scripts and pages that I am trying to use
thanks for any help!
 
make sure that there are no blank lines, spaces either in the main file or any include file that send output to the browse.

php will tell you the file and line in which output was first sent to the browser, in its error message.
 
Can you show your code for the particular submit button. or are we supposed to guess?

The most I can tell you is that you can't have anything being output to the browser before calling the header call, not even white space.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
If you get the message that headers are already sent, that message usually comes with both the error location and the line where non-header output was sent. That is where to look.
 
@DonQuichote

is that not what I said in my post?
 
all the scripts i used are on the website!
-> scripts -> Php download -> The code
this should be EXACTLY what I used on the acual web page, exept i changed all the ('s to ['s etc.
 
post the error message you get. I do not receive an error message.
 
The page brings up:

Warning: Cannot modify header information - headers already sent by (output started at / in / on line 4
PK1¤q7%ß?8Ô@{ScriptInfo.xmlSDfÈœ#2Ccd`ia``0`€ fd3YE?„Å÷“ .ñ_©S·ùÉŒ[Ž‘‰??‰¡†?$+ ÁðŸQž$R«$@lˆ83ÄX«¹?A@¢†¢FHUT P?GP?GP?G]?ÍjÃ0„ï…¼ƒÐ½Z«½Ù¡…6—ÐÒ«b[T?F»Žóø‘ìÒ”ggv¿‘Ôö께„6††KQñm»yPÇ.Ù‘^Ã9²Øð)…Úc?º k\\ä«W_Ñ6| k€yžÅü,bêᩪ$|½¿»Áxýh’?áì󎓼Р'yMyXäA{Óî“1d’‚EåéάØZLdš˜‹=‹AÁ_7‡_Nq¢?äÚÒÇç6:hú΄”•?‰.zøy…ÍpèWšÈ;¿Ûùü+÷¯ÉòPKè£q7æ¤,Ì‚ø ygreeter.jsSDdȬxÇHcd`ia``0`€ fd3YE?„Å÷“ .ñ_©S·ùÉŒ[Ž‘‰??‰¡†?$+ ÂðŸQ§Z1?" ˆ&ˆ ¡ÀDX/È "5Œ5B@UT ”O?G•O?GÙN?GÍRMKÃ@}× þ‡µ§mScriptPack created using MPScripts.net Script Packager v1.1.13
 
as said, i do not receive the error.

but you will find that there is something wrong at line 4 of the script plscdownload.php. typically this is a single line break or element of whitespace.
 
jpadie, do you not recive an error or does the download work?
 
both are true statements. I do not receive the error AND the download works. i did not log-in, of course.

 
both are, indeed, true statements but i note that the code that you post on your site starts like this

Code:
html dir="ltr"]
    [head]
        [title></title]
        [?php header("Content-type: application/x-plsc");

this cannot work (i'm surprised that i don't receive an error). you are doing what i said you could not: outputting to the browser before you are sending the http headers.

these lines are _output_
Code:
html dir="ltr"]
    [head]
        [title></title]
and MUST NOT coexist with anything that you want to download.
 
In actual fack the script does not usually contain these, but are automaticly placed there by the hosting when I edit the script online. As far as I know this is not in the saved file uploaded by FTP. But whether or not this is placed into the file as it's loaded from the host. As i often try to edit the files and update the script online, this should not currently be on the file. Sorry.
 
be that as it may - the script is outputting to the browser before the headers are set. this is what gives the error message.
 
I'm not sure if this is what is happening to you or if you're even on a free web host, but:

On free web hosting sites that I've used, the server will try to inject its own HTML to display advertising on the website. This may be messing up your output.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top