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!

Premature end of script headers: php.exe

Status
Not open for further replies.

Naoise

Programmer
Dec 23, 2004
318
IE
[Fri Oct 05 22:08:15 2007] [error] [client 127.0.0.1] Premature end of script headers: php.exe

Just upgraded to Apache 2.0.52 and PHP5 and previously working code gives the above error.

Even a simple

<?

echo "test";

?>

gives this error. Is this a php.ini problem or a httpd.conf error? I know that everything in the .conf is pointing to the correct PHP directory but the parsing of the php file itself seems to be the problem. Any help appreciated. I posted here just in case it was Apache related.
 
You might want to look at your php.ini file to see if it is set to accept short tags like <? rather than <?php.



 
I'm running this as as Apache plugin and I had tried to see if using strict php tag delimiters worked but it did not. Would it be of more benefit to post my http.conf or php.ini contents (large as they are)?
 
Can anybody help me further on this?
 
The error apache is sending means that for some reason it did not read the header information. This is usually because the shebang is missing. The shebang is the first line on the script's page and tells apache which interpreter to use. Php does not require a shebang because it is not the same as other scripts in that it does not execute on the server side. It is a lot more like html. Neither of them need any special handling by apache. This is not true for say cgi scripts. Apache needs to be told how to parse them. If the ScriptAlias directive is used for the cgi-bin directory, then apache will parse everything in that directory as script. The same is true if you use the "Options +ExecCGI" directive in a directory container. This tells apache to parse everything in that directory as script. This may cause problems a lot like what you are experiencing. You will get this type of problem when you put html pages in your cgi-bin also. Some times setting the execute bit on a file will cause linux to try to execute it as a shell script but since you are running Windows, that doesn't come into play.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top