Jump to content

Archived

This topic is now archived and is closed to further replies.

thatguy

Clicking link downloads source

Recommended Posts

I just installed PHP on my Debian system, but for some strange reason when I open a .php file in Firefox it downloads the source instead of running the php script. The crazy thing is that when I open the same page in Internet Explorer it runs it the way it should! I have an indentical installation on another system and it works properly. Any idea what could be causing it?

Share this post


Link to post
Share on other sites
php files are 'run' by the webserver and not the browser. Check the AddHandler section of the apache.conf (httpd.conf) file is configured correctly.

Share this post


Link to post
Share on other sites
Yeah by "it" I was referring to the web server :) I'm not too clear on what the AddHandler section should be like. My httpd.conf file is identical to the one on my working web server

Share this post


Link to post
Share on other sites
Have you restarted the webserver since you made the changes (to enable php)?

Are you on unix or windows? if unix 'grep -i php httpd.conf' and what's the output?

should be something like:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.php
LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c

also worth running through: [a href=\"http://www.php.net/manual/en/install.php\" target=\"_blank\"]http://www.php.net/manual/en/install.php[/a]

Share this post


Link to post
Share on other sites
I have restarted the web server. This is what the grep command gave me

DirectoryIndex index.html index.htm index.shtml index.cgi index.php
# For example, the PHP 3.x module (not part of the Apache
# distribution - see [a href=\"http://www.php.net)\" target=\"_blank\"]http://www.php.net)[/a] will typically use:
#AddType application/x-httpd-php3 .php3
#AddType application/x-httpd-php3-source .phps
# And for PHP 4.x, use:
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

Share this post


Link to post
Share on other sites

and your other server is the same? the #'s are comments, which means the server ignores that line when it starts up. you need to un-comment (delete the #'s) the php directives (lines) for the php version you have installed.

Share this post


Link to post
Share on other sites
Thanks that worked! It makes me wonder why php works on my other system though with those lines commented out

Share this post


Link to post
Share on other sites
maybe using a different httpd.conf than the one you're looking at, or may have another .conf file Included.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.