Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Having trouble with custom php.ini file
June 26, 2007, 11:34 pm
rate this thread
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
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
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.
- » Determining document root when $_SERVER['DOCUMENT_ROOT'] is not an option
- — Previous thread in » PHP Scripting Forum