Apache Virtual Host not parsing PHP

This could also be due to php files using short php tags <? instead of <?php. By default, short tags are not enabled in the php.ini config file.


This finally put me on the right path:

http://www.linuxquestions.org/questions/linux-server-73/php-not-working-on-one-vhost-but-works-on-all-others-851093/

Here's the solution:

In the <Directory> section, I included these lines:

<IfModule sapi_apache2.c>
    php_admin_flag engine on
</IfModule>
<IfModule mod_php5.c>
    php_admin_flag engine on
</IfModule>

Or, a redacted copy/paste of the solution on my server:

<Directory "/var/www/vhosts/A2/httpdocs">
    <IfModule sapi_apache2.c>
        php_admin_flag engine on
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_flag engine on
    </IfModule>

    (Other configuration parameters)

</Directory>

In my case, the problem was fixed by running the following command:

apt-get install libapache2-mod-php

Tags:

Php

Apache