Saturday, September 13, 2008

PHP and CGI working in the same directory

While it's not possible to get CGI and PHP to work within the same file, you can get .html and .htm files to use cgi/php scripts alternately in the same directory with the following .htaccess file:

RemoveHandler .html
AddType text/html .htm
AddHandler application/x-httpd-php .php .html
AddHandler server-parsed .htm .html

If anyone can prove the previous statement false, please do! I spent hours googling and hacking to try to get php and cgi to work within the same file.

Also, the way the above file is parsed makes no sense to me. It is inverted from how I would have thought it should work.

No comments: