The popular gallery webapp still uses dated short PHP open tags <?, this makes it difficult to deploy in a subdirectory of a site that uses XHTML which requires short_open_tag=off to use <?xml… headers, leading to the following error.
Parse error: syntax error, unexpected T_STRING in /home/foo/example.com/index.php on line 3
This problem is further complicated by PHP CGI which means that php_value directives in .htaccess files cannot be used as they are with mod_php.
The solution: Per directory .htaccess calling php-cgi with a different php.ini directory.
/ /cgi-bin/ /cgi-bin/php.ini < contains short_open_tag=off to support XHTML /cgi-bin/php-wrapper.fcgi < calls /dh/cgi-system/php5.cgi /cgi-bin/php-wrapper-gallery.fcgi < call /dh/cgi-system/php5.cgi -c /home/foo/example.com/gallery /gallery/.htaccess < Points at php-wrapper.fcgi /gallery/php.ini < contains short_open_tag=on /gallery/.htaccess < Points at php-wrapper-gallery.fcgi
What it looks like in terms of processes…
ps afx | grep php5.cgi 33603 ? R 0:00 /dh/cgi-system/php5.cgi -c /home/foo/example.com/gallery 32621 ? S 0:03 /dh/cgi-system/php5.cgi