Php – Apache is not interpreting .PHP files

apache-2.2PHPphp5

I recently downloaded OpenSUSE OS version 11.4 from the site to use it as a server..In order to do that I downloaded the server edition that has Apache/2.2.17 and PHP5 downloaded by default…..Ok till now it is fine

Now I started the Apache successfully and put a test.php file in the documentRoot directory.
test.php contain only <?php phpinfo() ?>

Then using my browser I typed http://localhost/test.php
and here was the problem
the browser didn't display what phpinfo() should display, instead it asked me whether I want to open or save test.php…which is driving me crazy….
I googled a lot but no solution

THis is /etc/apache2/conf.d/php5.conf

<IfModule mod_php5.c>
    AddHandler application/x-httpd-php .php4
    AddHandler application/x-httpd-php .php5
    AddHandler application/x-httpd-php .php
    AddHandler application/x-httpd-php-source .php4s
    AddHandler application/x-httpd-php-source .php5s
    AddHandler application/x-httpd-php-source .phps
    DirectoryIndex index.php4
    DirectoryIndex index.php5
    DirectoryIndex index.php
</IfModule>

Best Answer

One thing worth trying, is verifying that your project is not in a user dir (public_html folder), or that the configuration in php5.conf (/etc/apache2/mods-available/php5.conf for some configuration) allows such interpretation.

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
    SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    #<IfModule mod_userdir.c>
    #    <Directory /home/*/public_html>
    #        php_admin_value engine Off
    #    </Directory>
    #</IfModule>
</IfModule>