AddType (Parsing PHP in HTML files)


#1

Can some one help me explain why the following script doesn’t work on my DreamHost server, but does on every other apache server I have ever tried:

http://www.desilva.biz/php/phpinhtml.html

Thank You.


#2

[quote]Can some one help me explain why the following script doesn’t work on my DreamHost server, but does on every other apache server I have ever tried:

http://www.desilva.biz/php/phpinhtml.html

Thank You.[/quote]

Ah, the joy of following instructions that leave out all the important details :smiley:

You see, application/x-httpd-php isn’t really a content-type, its used so Apache realizes to a use a PHP SAPI on the file.

And of course what the article leaves out is that particular token is usually used to run PHP under mod_php SAPI. Though on my machine it runs it under an Apache 2.0 Handler SAPI. Same difference I guess - PHP runs as the server user ‘dhapache’, which is not good…

Anyway, DreamHost doesn’t support running mod_php so I’m not surprised it doesn’t work the same on your machine. So you’re stuck with the CGI/FastCGI SAPI instead, and you want this in your .htaccess file:

AddHandler php5-cgi .php .htm .htmlDo not add the RemoveHandler directive.

Customer since 2000 :cool: openvein.org