apache2 with mod_php

Kurt Wall kwall
Mon May 17 11:59:51 PDT 2004


In a 0.8K blaze of typing glory, Collins Richey wrote:
> I'm getting frazzled after two days of googling and rtfm.  I can't get
> even simple php programs like the following to work.  Always terminates
> with "Premature end of script headers".
> 
> <html>
> <head>
> <title>A sample</title>
> </head>
> <body>
> <?php echo 'The first line'; ?>
> </body>
> </html>
> 
> Sigh, Apache is really a dumb$#@! program.  Even with LogLevel debug,
> no meaningful help is given.  Only " I don't like your setup, but I
> won't tell you why."
> 
> I get the same results from either the global cgi-bin directory or under
> my cgi-bin directory, but I can run cgi programs from either.

I don't think cgi-bin has anything to do with it. For PHP4, I have the
following in httpd.conf:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php

Add these lines, or uncomment them, run "apachectl configtest" to
make usre Apache likes the contents of httpd.conf, and then restart
Apache.

I put your card into $HOME/public_html/index.php and, voila:

$ lynx -dump http://localhost/~kwall/index.php
   The first line

And, just for fun, you an see the results on my public Web server:
http://kurtwerks.com/index.php

Kurt
-- 
"The more data I punch in this card, the lighter it becomes, and the
lower the mailing cost."
		-- Stan Kelly-Bootle, "The Devil's DP Dictionary"



More information about the Linux-users mailing list