[Nottingham] PHP
Godfrey Nix
godfrey at gnnix.co.uk
Thu Feb 3 08:40:58 GMT 2005
On Wed, 2005-02-02 at 15:04, Robert Ross wrote:
> Hi everyone,
>
> Having a bit of a problem with setting up PHP4 to run with apache2.
>
> I have set up a server from scratch and installed apache and PHP from the
> start. I am now in the process of putting on some virtual hosts, but when I
> try to run .php pages I get an error telling me the file is an
> "application/x-httpd-php" and would I like to download it or open it in an
> appliation! The mime type seems to be OK and on the main server the page
> opens without any problems, it just seems to throw a wobbly on the virtual
> server.
>
> Has anybody any ideas?
>
On apache2 you do not need the mime.type file (well my server is working
without it!) Apache2 has a conf.d directory with php.conf in it. This
file has just two crucial lines to get php working -
LoadModule php4_module /path/to/libphp4.so
AddType application/x-httpd-php .php
Note that the AddType line is in place of a line in mime.types, and the
LoadModule will provide apache with a method of handling x-httpd-php
I have just created a virtual block for myself and it all works OK. I
would suggest a few tests -
create a plain test file in the same directory and try to browse it;
create a simple shell script or perl script and try to fetch those.
Do you have any other php-related lines in either your main httpd.conf
or within the VirtualHost block? Do you have any .htaccess file ?
Here is my VirtualHost block -
<VirtualHost 10.0.0.41>
ServerAdmin godfrey at laptop
ServerName 10.0.0.41
DocumentRoot /home/godfrey/public_html
</VirtualHost>
Hope this helps.
Godfrey
More information about the Nottingham
mailing list