htaccess auto_prepend

thespeshulk

New Member
Messages
9
Reaction score
0
Points
0
I am trying to get my common functions file (lets call it foo.php) to auto prepend to each of my pages so I don't have to add an include path to the top of each page. I know it can be done using php_value auto_prepend but I am getting a "500 Internal Server Error" whenever I try to do this.

I am trying to use this line:
php_value auto_prepend_file /path/to/includes/folder/foo.php

I have double checked spelling and have tried it with and without "AddType application/x-httpd-php .php .htm .html"
and "Options +FollowSymlinks"

There might be something I'm missing. Any ideas would help. Thanks in advance
 

crymson

New Member
Messages
13
Reaction score
0
Points
0
i'm not sure if this will help, but have you tried with quotes ?

php_value auto_prepend_file "/path/to/includes/folder/foo.php"

And use the full path to your file (not relative), it might help too.
 

thespeshulk

New Member
Messages
9
Reaction score
0
Points
0
I have tried it both with and without quotes but neither worked :dunno:

Is there a variable that's similar to PhP's $_SERVER[document_root'] ? I tried looking for this but couldn't find anything on it
Edit:
well i used $_SERVER[document_root'] to get the full path and appended that output to the beginning of my includes path but to no avail.

tried it with and without quotes again.
 
Last edited:

thespeshulk

New Member
Messages
9
Reaction score
0
Points
0
Code:
# -FrontPage-

Options +FollowSymlinks

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

#AddType application/x-httpd-php .php .htm .html

php_value auto_prepend_file full/path/to/root/includes/common.php

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
plus some authentication lines which i wont display for obvious reasons and full/path/to/root/includes/common.php is where the actual path is
 

crymson

New Member
Messages
13
Reaction score
0
Points
0
I just tested your .htaccess configuration on a local server... and it worked. So the syntax is good. There are no errors in your file.

I tried to change the file permissions and even give a bad path, but I get a PHP error, not a "500 internal error".

I did a little googling around, and found that there are some php setups that does not support the "php_value" directive. Maybe the directive is not supported or even restricted by the server configuration.

If your website is hosted here on X10, i would not be surprised by that, since they are using restrictions on PHP.

I played with one of my site .htaccess (hosted on X10, add free server), and as soon as I put a "php_value" directive, it gives me a "500 internal server error". So it definitively looks like a server configuration problem (or restriction).

So... you may have to "manually" include your option file trough your site... sorry.
 

thespeshulk

New Member
Messages
9
Reaction score
0
Points
0
Thanks for testing it out. I also did so on the network here at my school and it worked fine just like you said. I guess it must be the server config-my site is hosted here on x10hosting. oh well i'll have to do it the old fashioned way it seems :sad:.

Thanks for helping me figure this out.
 
Top