Page 1 of 1

Error: premature end of headers

Posted: Thu Nov 07, 2002 12:44 pm
by Shattered
Im trying to learn php and I set up my own server to do it; the problem is everything as simple as a hello world to anything else errors out with the above error; "Premature End of Headers"

I tried to fix this with the addition of the use of the header() but I still got the same thing and no data was sent due to it erroring out.. I dont what to do and I cant learn php without this working.. I know Im a idiot so if you want to say it by all means do so but remember I already know it so saying so is redundant; I have searched google, I have read everything I could to figure this out, but I still cant ghet this working; please somone help!

Posted: Thu Nov 07, 2002 12:59 pm
by Shattered
This is not something like trying to add headers after data is sent or anything in the sticky posts.. please help me.

Posted: Thu Nov 07, 2002 1:09 pm
by hob_goblin
What version of PHP are you running?
If it's the latest, you could try reinstalling it.

Have you tried installing some other extensions or something? One of them may have messed up or something.

Can you give us the exact error?

Does <? phpinfo(); ?> work?

Posted: Thu Nov 07, 2002 1:15 pm
by Shattered
no phpinfo() doesnt work.. no matter what i do, no matter what i have tried, I ALWAYS get teh same error; Premature end of script headers.. I have been going at this for days now, and Im tired as heck but I ahve to see this working.

Im running Redhat Linux 8.0/ apache 2.43 and the php version i installed after getting directly from php.net 2 days ago.. cgi and perl work great but I know perl already and want to add php to the things I know

The exect error is at follows:

Premature end of script headers: phptext.php

Thats taken directly from my logs and the file I greped out of them.. nothing seems to work and I dont understand it, even a blank .php file errors out like this.

Sorry for my grammer and spelling, I have been up a long time triing to get this working and my fingers are not the only part of me that is tired.

Posted: Thu Nov 07, 2002 2:14 pm
by volka
do doc_root = in php.ini and DocumentRoot in httpd.conf match?

Posted: Thu Nov 07, 2002 2:20 pm
by Shattered
no, in httpd.conf I have it set for:
/home

So the different people that have shells on my box can learn too if they want (my brother wants to larn as well)
and in php.ini it isnt set to anything, just looks like:
doc_root =

Is that bad?

Posted: Thu Nov 07, 2002 3:07 pm
by volka
for the module (not cgi-) version of php this should be sufficient.
Nevermind ;)

Posted: Thu Nov 07, 2002 3:10 pm
by Shattered
I figured out my problem.. it was a apache thing not a php thing.. I had to add a as-is handeler to php so they controled thee own headers..

Thank you everyone who offered help, Im getting some sleep now.. next time I post ym garmmer and sellign will have improverd greatly I assure you.. time for basic_maintainance('sleep');

a tip

Posted: Thu Nov 07, 2002 10:49 pm
by AVATAr
a tip: apache toolbox (on http://www.freshmeat.net)

interesting!