pache + PHP Script causes: Premature end of script headers

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PsychoNL
Forum Newbie
Posts: 1
Joined: Wed Aug 06, 2003 7:53 am
Location: Dordrecht

pache + PHP Script causes: Premature end of script headers

Post by PsychoNL »

Hi,

I'm trying to get PHP scripts working under my apache webserver.
I already have Perl script working on the same apache server in the same directories with the same accessrights.

versions of the products:
Linux version 2.4.18-27.8.0smp (bhcompile@sylvester.devel.redhat.com) (gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)) #1 SMP Fri Mar 14 05:47:33 EST 2003

Server version: Apache/2.0.40
Server built: May 22 2003 05:19:58

php 4.2.2

I tried using this simple PHP code (index.php):
<html><head><title>simple for loop in PHP</title></head>
<body>
<?php
echo "Hello World!\n";
?>
</body></html>

the php.conf (/etc/httpd/conf.d/) is asfollows
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288
</Files>

in the httpd.conf ExecCGI are set and the module is enabled:
DirectoryIndex index.html index.htm index.html.var index.pl index.php3 index.php index.cgi
AddHandler cgi-script .php
AddHandler cgi-script .php3
LogLevel debug

permissions are set by:
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec ExecCGI
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>

(apache is both the user and the group owner)

the script is accessable via a virtual host and the perl scripts do work.

i've searched for a solution and couldn't find any way to get more debug details or how to get this working

the only time i got another type of error was when i added #!/usr/bin/php as the first line.
a security error was the result (Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.)

My question is, how can i either get PHP scripts to work on my server or get a more detailed error then "Premature end of script headers". and what exactly does this error mean.

running "php index.php" returns:

X-Powered-By: PHP/4.2.2
Content-type: text/html


<html>
<head>
<title>simple for loop in PHP</title>
</head>
<body>

Hello World!

</body>
</html>





Anyone, please save me from going (more) nuts.

Reguards,

PsychoNL
Post Reply