Adding Additional Extensions for PHP


#1

Hi, I have the following placed in my .htaccess file to run files with xml and rss extensions as php

AddType application/x-httpd-php .xml .rss

but i am getting an error with the php classes because although my site is setup to run php 5 the files with xml extensions are running in php 4. Appreciate if you could help me resolve this problem.

Thanks


#2

application/x-httpd-php uses the mod_php within Apache and at this time mod_php is PHP4 with no plans to change it.

Why do you want to run .xml and .rss as PHP files anyway? That kind of defeats the purpose for their intended uses; generic text files for easy reading. Let me also remind you, XML is built to be a text format, command line or browser. Making it dependent on PHP like you want will cause issues if you decide to read it in like an XML file via the command line. RSS, on the other hand, is built to be served through HTTP and you can get away making it dependent on PHP.

Anyway, what you want to do is setup an acction and then set that as the handler:
Action dh-php /cgi-system/php5.cgi
AddHandler dh-php .xml .rss

That will do what you want, using DH’s PHP5 install.


yerba# rm -rf /etc
yerba#