Having trouble with custom php.ini file

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

My hosting company claims I can create php.ini files besides the
master one.  So I have created this file



register_globals = on
post_max_size = 20M
memory_limit = 80M
upload_max_filesize = 20M
max_execution_time = 120
auto_prepend_file = /web_root/subdir1/phpconfig.php

and the contents of /web_root/subdir1/phpconfig.php are


$_SERVER['DOCUMENT_ROOT'] = '/home/foo/whatever';


but when I visit the file /web_root/subdir1/test.php which contains

        echo $_SERVER['DOCUMENT_ROOT'];

The string "/home/foo/whatever" is NOT printed to the screen.  What is
wrong with the sequence above?

Thanks, - Dave

Re: Having trouble with custom php.ini file

On Jun 27, 12:34 am, "laredotorn...@zipmail.com"
Quoted text here. Click to load it

is php running as a module? if so did you restart the server.
this is a bit of a hack anyway!
Usually you would have all the paths worked out and stored /in the
application layer/ so that you are not resorting to workarounds, the
protabilty depends on a bit of string manipulation nothing more - to
find things like the document root.
For instance, replacing
with the empty string, or '/'


gets you the document root of the host you are on.

Site Timeline