Apache not processing php file in Linux/OpenSuse

3.4k views Asked by At

I installed PHP and Apache2 in my machine running on OpenSuse. The problem is: Apache process only static HTML file. When I put an URL for a PHP file, it makes no processing, it just propose to save the file to the hard disk.

I think I have to enable something but I don't know what and where. enter image description here

1

There are 1 answers

1
Priyank On

first check whether you have php5.conf in mods-enabled or not.for checking php5 mods-enables run below command.

sudo dpkg -S php5 | grep libapache2-mod-php5 

also check file /etc/apache2/mods-available/php5.conf containing below code or not:

<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>

Since it's a conffile, it's possible that it's not installed with the upgrade. To fix that purge it and then install it again:

sudo apt-get purge libapache2-mod-php5
sudo apt-get install libapache2-mod-php5  

also To enable PHP, you have to run:

sudo a2enmod php5

Restart the webserver after:

sudo /etc/init.d/apache2 restart

hope this will helps you...