[lug] php hosed!?

Nate Duehr nate at natetech.com
Fri Jan 19 08:13:53 MST 2001


Deva Samartha wrote:
> 
> It is PHP3, and it was running before, it appears to be stanard under SuSE.
> 
> Now, what happens is that Apache fails to funnel the php3 code thru the
> appropriate module to do it's magic and expand the php code into html and
> sent it to the client - so it appears.
> 
> Instead of expanding and giving me the great status/config page, the php
> code displays in the browser as a puny:
> 
> <?
> phpinfo()
> ?>

<snip>

Ok, sounds like one of two things is happening, either the PHP3 module
isn't getting loaded/used by Apache at all, or your MIME types are
confused and Apache is not seeing files with .php or .php3 extensions as
PHP files to be handled by the module.

First off, make sure you have a LoadModule statement in your Apache
httpd.conf file or equivalent... here's mine:

LoadModule php3_module /usr/lib/apache/1.3/libphp3.so

If that wasn't there, or was commented out, uncomment it/add it and
restart/reload Apache.  That should take care of it.  Or at least you
should be able to to run phpinfo() in an otherwise blank HTML file.  

If it doesn't...

Check your mime.types file and make sure you have lines like the
following (also from my setup):

application/x-httpd-php                         phtml pht php
application/x-httpd-php3                        php3
application/x-httpd-php3-source                 phps
application/x-httpd-php3-preprocessed           php3p

These are optimized for php3 -- php4 ones need to look a little different.

Ok, that should be a start.  If those don't work, another option is to
specifically call out loading the PHP module at the top of your HTML
file.  If you're using CGI versions of PHP instead of the Apache
modules, this is a common thing to see in web page source.

(I guess that was another question I forgot to ask -- I'm assuming
you're using the PHP modules for Apache and not running PHP as a CGI...)

Let us know how it's going!

Nate




More information about the LUG mailing list