Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php won't autoprepend an htm file



2:13 am on Feb 23, 2012 (gmt 0)

I have tried several settings in .htaccess each of which appear to get my .htm files in the directory being parsed by php which is what I want. Some I have tried that seem to work in that they do get htm to be processed by php are:

AddType application/x-httpd-php .htm
AddType php5-script .htm
AddHandler application/x-httpd-php .htm
AddHandler php5-script .htm

Unfortunately, my php autoprepend file, set in php5.ini, is not running. It get run when it should when accessing a .php file but not processing any .htm files. If I rename the files from .htm to .php they work correctly, but when I rename them back to .htm files the autoprepend does not happen and they break.

I have done this many times before without a problem, but not this time. Is there something else I need to do that I have forgotten?

Driving me nuts!



2:32 am on Feb 23, 2012 (gmt 0)

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Try doing it like this in .htaccess:

#make all .htm/,html run PHP
AddType application/x-httpd-php .htm .html

#prepend a PHP script to all files
php_value auto_prepend_file "/var/www/vhosts/example.com/httpdocs/somescript.php"

Also try restarting the web server, sometimes you need to restart HTTPD when odd things happen like this.

Featured Threads

Hot Threads This Week

Hot Threads This Month