Page 1 of 1

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

Posted: Sun May 14, 2006 5:10 pm
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. :(

Posted: Tue May 16, 2006 8:09 pm
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.

Posted: Tue May 16, 2006 8:16 pm
by Burrito
it is the 'LoadModule' directive.

it should look something like this:

Code: Select all

LoadModule php5_module /PHP/php5apache2.dll

Posted: Tue May 16, 2006 8:19 pm
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.

Posted: Wed May 17, 2006 4:26 am
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.