Jump to content


Photo

Clicking link downloads source


  • Please log in to reply
7 replies to this topic

#1 thatguy

thatguy
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 17 April 2006 - 10:57 AM

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?

#2 DougieB2

DougieB2
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 17 April 2006 - 11:07 AM

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.

#3 thatguy

thatguy
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 17 April 2006 - 12:32 PM

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

#4 DougieB2

DougieB2
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 17 April 2006 - 12:48 PM

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]


#5 thatguy

thatguy
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 17 April 2006 - 01:40 PM

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


#6 DougieB2

DougieB2
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 17 April 2006 - 02:28 PM


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.

#7 thatguy

thatguy
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 17 April 2006 - 02:39 PM

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

#8 DougieB2

DougieB2
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 17 April 2006 - 03:03 PM

maybe using a different httpd.conf than the one you're looking at, or may have another .conf file Included.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users