php files not recognized in browser

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri May 13 13:06:29 UTC 2005


On Thu, May 12, 2005 at 10:55:32PM -0400, Alex Maynard wrote:
> Hi, I've got a newby question on a php set up problem.  This is probably a
> trivial question, but I'm stuck on it and would be grateful for any help I
> can find.
> 
> I set up apache/php/other application on linux using
> http://www.apachefriends.org/en/.
> 
> Everything including their test step worked fine.
> 
> But, when I tried to open a php file on my computer using mozilla I got
> the following error message:
> 
> The file "hello.php" is of type application/x-httpd-php, and Mozilla does
> not know how to handle this file type. The file is located at:
> /home/amaynard/share/private_html/php  What should Mozilla do with this
> file?
> 
> The strange thing is that Mozilla does recognize/open .php files on the internet (just not on
> my computer). And opera seemed to be able to open the .php file
> on my computer but I'm not sure it displayed correctly.
> 
> Following what I found on google I tried modifying the httpd config file:
> /etc/apache/httpd.conf   and adding the line:
> AddType application/x-httpd-php .php
> and then restarging http using:
> httpd:/opt/lampp/bin/httpd -k restart
> 
> But still no luck.
> 
> Does anyone have any suggestions?

Make apache realize php files should be run through the php interpreter,
not sent to the user.

LoadModule php4
AddType application/x-httpd-php .php

I tend to add .php3 to the above as well for backwards compatibility.

Maybe add to index list so index.php is a valid option for a directory.

No special permissions needed on the php file (other than allowing the
web server to read it).

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list