|
Posted by shimmyshack on 06/27/07 01:09
On Jun 27, 12:34 am, "laredotorn...@zipmail.com"
<laredotorn...@zipmail.com> wrote:
> Hi,
>
> My hosting company claims I can create php.ini files besides the
> master one. So I have created this file
>
> /web_root/php.ini
>
> containing
>
> register_globals = on
> post_max_size = 20M
> memory_limit = 80M
> upload_max_filesize = 20M
> max_execution_time = 120
> expose_php=off
> auto_prepend_file = /web_root/subdir1/phpconfig.php
>
> and the contents of /web_root/subdir1/phpconfig.php are
>
> <?php
>
> $_SERVER['DOCUMENT_ROOT'] = '/home/foo/whatever';
>
> ?>
>
> but when I visit the file /web_root/subdir1/test.php which contains
>
> <?php
> echo $_SERVER['DOCUMENT_ROOT'];
> ?>
>
> The string "/home/foo/whatever" is NOT printed to the screen. What is
> wrong with the sequence above?
>
> Thanks, - Dave
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
$_SERVER["SCRIPT_NAME"]
inside
$_SERVER["SCRIPT_FILENAME"]
with the empty string, or '/'
str_replace(
$_SERVER["SCRIPT_NAME"],
'/',
$_SERVER["SCRIPT_FILENAME"] );
gets you the document root of the host you are on.
Navigation:
[Reply to this message]
|