The usual way of parsing .html
files as PHP is to add either the first (PHP as an Apache module) or both (PHP as CGI) of the following lines to an .htaccess
file:
AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .htm
Sometimes that needs to be x-http-php5
, depending on the host:
AddType application/x-httpd-php5 .html .htm
AddHandler application/x-httpd-php5 .html .htm
However, I am now on a new host and no permeation of those lines work. In all cases the raw file is being sent to the browser, and wget
shows that x-httpd-php
is being presented as the Content-Type!
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Tue, 07 Aug 2012 14:16:40 GMT
Server: Apache
Last-Modified: Tue, 07 Aug 2012 07:46:44 GMT
ETag: "862239-14-4c6a83216c100"
Accept-Ranges: bytes
Content-Length: 20
X-Powered-By: PleskLin
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: application/x-httpd-php
Length: 20 [application/x-httpd-php]
Remote file exists.
Note that Length: 20
is exactly the length of <?php phpinfo(); ?>
, and that is what it is serving. I have confirmed that PHP is running as a module with the terrific tip in this SO answer. I have spoken with the maintainer of the server (an associate, so even if I switch hosts I would still like to help him resolve the issue) and he does not know what the issue or correct configuration is. The server is running Plesk on a Debian-based distro, if that matters at all.
This was in fact an Apache configuration issue, this page had the solution: http://kb.parallels.com/en/124
Reproduced here for posterity: