# Alternative for PHP auto_prepend_file?



## btoth (Mar 30, 2005)

My old website (on my old host) makes use of an .htaccess file with a "php_value auto_prepend_file /path/to/global/file" in order to provide each page of the site with global variables containing path information, etc.

This is very useful for developing a site locally and then uploading to the server as I only need to change the variables in a single file to put the site somewhere else.

The problem is that I switched hosts and the new host runs PHP as a CGI rather than a module.  Therefore, I can't use .htaccess to prepend a script to every page.  I can create my own PHP.INI file, but that will only apply to one directory, not the entire site.  Aside from having to convert every single URL and include() in my entire site to a relative URL, is there another way to auto-prepend a file to every web page in an entire site?


----------



## TommyWillB (Mar 30, 2005)

You can't change the Apache configuration... Right?

...You're looking for a PHP solutioion?

The only way I can think of is to have an index.php that then reads in the header plus the other files. So you'd have something like index.php?page=/subfolder/file.php


----------

