php config in Apache2's virtual hosts

Moderator: cah

Post Reply
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

php config in Apache2's virtual hosts

Post 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>
CAH, The Great
Post Reply