Forum Moderators: phranque

Message Too Old, No Replies

Having trouble with auto_prepend_file

Doesn't work...

         

mikewalterz

1:22 am on Jan 12, 2007 (gmt 0)

10+ Year Member



Hello again,
I was just researching about auto prepend and append and it seems that this doesn't work on the server (i don't know why)...

Here is the htaccess file:

<FilesMatch "\.html$">
# set the prepend file setting
php_value auto_prepend_file "learn.php"
</FilesMatch>

I have a learn.php which has hi and when i run an html file, it doesn't prepend anything (not sure why)...

Any idea?

Thanks!

jdMorgan

2:47 pm on Jan 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Any auto-prepend experts in the house?

*bump*

Jim

sonjay

3:53 pm on Jan 12, 2007 (gmt 0)

10+ Year Member



Are you sure that you've uploaded learn.php and that the path is correct?

What does learn.php include? You said it has hi, but what does that mean, exactly? Is it doing a php echo of the word 'hi'? Do you have html files set to be parsed for php?

Do you get any error messages? Do you have display_errors turned on?

What happens if you remove the <FilesMatch> container and just put the auto_prepend line in there?

Is your .htaccess (not htaccess) file named correctly, and is it being parsed? (IOW, is AllowOverrides enables, and do other directives in .htaccess work?)

mikewalterz

10:18 pm on Jan 12, 2007 (gmt 0)

10+ Year Member



Thanks for your reply.

The file is correctly placed (learn.php) and it should be able to access it. Inside the file it uses php echo to print out hi.

It still doesn't work when i remove the files thing at the top and bottom.

What is AllowOverrides? I dont think the server may be configured properly. Can you explain what i need to configure properly.

Thanks!

mikewalterz

11:39 pm on Jan 12, 2007 (gmt 0)

10+ Year Member



I found the error. My host didn't have AllowOverride All and so it didn't work.

Thanks Everyone!

sonjay

12:53 am on Jan 13, 2007 (gmt 0)

10+ Year Member



Excellent! I just had your response up and was trying to figure out how to explain AllowOverrides -- which I understand, but I'm not very good at explaining. Glad you got it sorted.