Page 1 of 1

php config in Apache2's virtual hosts

Posted: Thu Feb 20, 2014 4:54 pm
by cah
I have been testing why php doesn't work on rccgcms's virtual hosts for hours.
Finally, I found a post saying the following entries need to be added to virtual hosts' <Directory> and </Directory>.

Code: Select all

<IfModule sapi_apache2.c>
    php_admin_flag engine on
</IfModule>
<IfModule mod_php5.c>
    php_admin_flag engine on
</IfModule>
After checking again the virtual_hosts.conf, I realized there's a config section that turned off php_admin_flag engine from /var/www/vhosts:

Code: Select all

<Directory "/var/www/vhosts">
        AllowOverride All
        Options SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
        <IfModule sapi_apache2.c>
       php_admin_flag engine off
        </IfModule>
        <IfModule mod_php5.c>
       php_admin_flag engine off
        </IfModule>
</Directory>
I then changed from off to on and restarted Apache and all started to work!

Code: Select all

<Directory "/var/www/vhosts">
        AllowOverride All
        Options SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
        <IfModule sapi_apache2.c>
        php_admin_flag engine on
        </IfModule>
        <IfModule mod_php5.c>
        php_admin_flag engine on
        </IfModule>
</Directory>