I just got caught out with apache directory permissions while installing gallery for a virtual host. I previously had all the virtual hosts using the same strict directory permissions shown below:

<Directory /sites/<domain>/www/htdocs>
                AllowOverride AuthConfig
        </Directory>

This will generate 2 errors in the virtual host error log, the first of which is a php error:

[alert]  /sites/<domain>/www/htdocs/gallery/setup/.htaccess: php_value not allowed here

This can be fixed by adding the Options option to the AllowOverride statement, the second error:

[alert]  /sites/<domain>/www/htdocs/gallery/setup/.htaccess: RewriteEngine not allowed here

can be fixed by adding the FileInfo option. So the final directory block should look like this:

<Directory /sites/<domain>/www/htdocs>
                AllowOverride AuthConfig Options FileInfo
        </Directory>