i’m working on changing my site to use php5 cgi instead of php4 as an apache module. it’s going mostly fine, but i’m not sure of the best way to handle some php scripts that are not named *.php.
in one directory, i have a few files named *.png that contain php code that outputs png images. in another i have a *.rtf file that contains php code that outputs rtf. with php4 i just dropped a line like this into .htaccess for that directory:
AddType application/x-httpd-php .png
i came across this page in the wiki (http://wiki.dreamhost.com/index.php/PHP.ini), which says the php5 cgi executable is in /dh/cgi-system/php5.cgi and shows adding a handler to use the custom php.ini. from that it looks like i can do this:
AddHandler php-cgi .png
Action php-cgi /dh/cgi-system/php5.cgi
but it seems to me there should already be an Action defined that i could just use, which would mean i only need the AddHandler line (modified to use the right action of course).
another issue i’m going to have with this is that my local testing server doesn’t use cgi, and doesn’t have a /dh/ directory at all. is there a way i can specify that parts of .htaccess are for the live site on dreamhost and parts are for my test server? the domains, ports, and document roots are different between the two. i like to keep identical files on my test server and live server as much as possible, so i don’t make a change on the test server and then upload and break the live site!
edit: on second thought, it doesn’t look like /dh/ is accessible from .htaccess, since the example was talking about /cgi-bin/ which is under document root. so it looks like for now at least i have no way to use php5 for files not named *.php