Apache Won't Interpret PHP File - Wants to Download Instead

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
bradleitch
Forum Newbie
Posts: 1
Joined: Sun May 14, 2006 4:59 pm

Apache Won't Interpret PHP File - Wants to Download Instead

Post by bradleitch »

Hello,

I've just done a fresh install of SuSE 9.1 /w Apache 2 and PHP 4.

When I access the webserver it loads the default Apache page but when I go to access a .php file it asks me to download the file in my browser rather than run through the interpretor (when I download the file the PHP code is visible).

I've looked through just about every major PHP forum I could find and nobody seems to have a solid idea of why this happens -- and asking Novell is very similar to talking to a group of polished rocks.

Some interesting notes:

- When I run YaST it clearly states that the PHP4 module is installed and enabled
- The httpd.conf file contains all the necessary mime/type information for PHP
- It seems to be loading the right PHP module (although I couldn't find libphp4.so on the box)

I'm not an administrator (just a non-technical designer). Re-installing/compiling PHP seems... incredibly difficult. The other funny thing is I've used SuSE 9.1 before with Apache 2 and PHP and never encountered a problem off a fresh install. It's something that's just come up this time. :/

Any help would be really appreciated... I'm just about ready to give up on dealing with Linux and move back to a Microsoft platform... say good-bye to stability. :(
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Is your httpd.conf configured to parse .php files through the PHP engine? I am drawing a total blank right now on the entry that needs to be edited in the apache configuration file, but I think if you search for 'httpd.conf' and author 'timvw' using the search form here you might be pointed in the right direction. I recall him posting once or twice about the entry that needs editing.

If you can't find it, when I get to my development machine, I will look at my httpd.conf and post back.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

it is the 'LoadModule' directive.

it should look something like this:

Code: Select all

LoadModule php5_module /PHP/php5apache2.dll
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I knew someone would know that directive. Thanks, Burr...

Bear in mind bradleitch that you will need to reference your php executable for your Linux system.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Ahem...

AddType application/x-httpd-php .php

Required to tell Apache how to handle PHP files. There's also a need to add index.php as a valid index file otherwise Apache will ignore index.php files and load the directory view unless explicitly added to a url.
Post Reply