Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

auto prepend file not working with .html and .css files

File types parsed as PHP are ignored



10:26 pm on Jan 4, 2009 (gmt 0)

5+ Year Member

I am having trouble using the auto_prepend_file PHP.ini directive, which automatically includes a file to every PHP script on my web application.

You see, in my .htaccess file I have the line "AddType application/x-httpd-php .html .css", which let's me include PHP code inside .html and .css files. Problem is my functions which are supposed to load in every PHP script are not being loaded in .html and .css files.

Is there a way to get around this? It seems to be working fine on my local machine, maybe this is a problem with my hosting company?


12:22 am on Jan 5, 2009 (gmt 0)

5+ Year Member

try creating the php code in a seperate file, and use:
include '';


7:41 am on Jan 5, 2009 (gmt 0)

5+ Year Member

frogz, of course I could simply just call the PHP file I am "auto_prepending" on every single .css and .html file I have, but that would of course defeat the purpose of using auto_prepend_file in the first place.

I love auto_prepend_file because this way I don't have to call include() on every script. I like having all functions and necessary start-up functions already included in every file. I don't wanna have to include that line to every single HTML and CSS file.


Featured Threads

Hot Threads This Week

Hot Threads This Month