+ Reply to Thread
Results 1 to 8 of 8

Thread: htaccess auto_prepend

  1. #1
    thespeshulk is offline x10Hosting Member thespeshulk is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    9

    htaccess auto_prepend

    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

  2. #2
    crymson's Avatar
    crymson is offline x10Hosting Member crymson is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Canada, province of Québec
    Posts
    13

    Re: htaccess auto_prepend

    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.
    Everyone, let's sing the Whistle Song !

  3. #3
    thespeshulk is offline x10Hosting Member thespeshulk is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    9

    Re: htaccess auto_prepend

    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 by thespeshulk; 11-12-2008 at 08:03 PM. Reason: Automerged Doublepost

  4. #4
    crymson's Avatar
    crymson is offline x10Hosting Member crymson is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Canada, province of Québec
    Posts
    13

    Re: htaccess auto_prepend

    Can you show me the content of your .htaccess file ?
    Everyone, let's sing the Whistle Song !

  5. #5
    thespeshulk is offline x10Hosting Member thespeshulk is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    9

    Re: htaccess auto_prepend

    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

  6. #6
    crymson's Avatar
    crymson is offline x10Hosting Member crymson is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Canada, province of Québec
    Posts
    13

    Re: htaccess auto_prepend

    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.
    Everyone, let's sing the Whistle Song !

  7. #7
    thespeshulk is offline x10Hosting Member thespeshulk is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    9

    Re: htaccess auto_prepend

    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.

  8. #8
    crymson's Avatar
    crymson is offline x10Hosting Member crymson is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Canada, province of Québec
    Posts
    13

    Re: htaccess auto_prepend

    No problem Dude. Good luck.
    Everyone, let's sing the Whistle Song !

+ Reply to Thread

Similar Threads

  1. HTACCESS Help
    By takuhii in forum Free Hosting
    Replies: 2
    Last Post: 09-30-2008, 03:35 PM
  2. Internal Server Error
    By Tom743 in forum Free Hosting
    Replies: 10
    Last Post: 08-28-2008, 01:16 PM
  3. adding subdomains to smf with htaccess?
    By pirata7z in forum Programming Help
    Replies: 7
    Last Post: 12-20-2007, 02:20 PM
  4. Replies: 2
    Last Post: 10-16-2005, 12:46 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers