thatguy Posted April 17, 2006 Share Posted April 17, 2006 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? Quote Link to comment Share on other sites More sharing options...
DougieB2 Posted April 17, 2006 Share Posted April 17, 2006 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. Quote Link to comment Share on other sites More sharing options...
thatguy Posted April 17, 2006 Author Share Posted April 17, 2006 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 Quote Link to comment Share on other sites More sharing options...
DougieB2 Posted April 17, 2006 Share Posted April 17, 2006 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 .phpAddType application/x-httpd-php-source .phpsDirectoryIndex index.html index.phpLoadModule php4_module libexec/httpd/libphp4.soAddModule mod_php4.calso worth running through: [a href=\"http://www.php.net/manual/en/install.php\" target=\"_blank\"]http://www.php.net/manual/en/install.php[/a] Quote Link to comment Share on other sites More sharing options...
thatguy Posted April 17, 2006 Author Share Posted April 17, 2006 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 Quote Link to comment Share on other sites More sharing options...
DougieB2 Posted April 17, 2006 Share Posted April 17, 2006 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. Quote Link to comment Share on other sites More sharing options...
thatguy Posted April 17, 2006 Author Share Posted April 17, 2006 Thanks that worked! It makes me wonder why php works on my other system though with those lines commented out Quote Link to comment Share on other sites More sharing options...
DougieB2 Posted April 17, 2006 Share Posted April 17, 2006 maybe using a different httpd.conf than the one you're looking at, or may have another .conf file Included. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.