Re: How can I replace $_SERVER["DOCUMENT_ROOT"] in PHP 7.0?

[email protected] (Ashley Sheridan)
Newsgroups php.general
Message-ID <[email protected]>
On 15/09/2021 09:08, Bo Berglund wrote:
> On Tue, 14 Sep 2021 13:28:49 +0100, Ashley Sheridan <[email protected]>
> wrote:
>
>> On 14/09/2021 11:32, Bo Berglund wrote:
>>> On Tue, 14 Sep 2021 11:21:00 +0100, Ashley Sheridan <[email protected]>
>>> wrote:
>>>
>>>> The basic steps would have been just checking what
>>>> $_SERVER['DOCUMENT_ROOT'] contained. That would have negated pretty much
>>>> all the rest of the test code, etc, that you wrote, as that's the actual
>>>> problem.
>>> Do you mean to for example do some kind of dir listing based on
>>> $_SERVER['DOCUMENT_ROOT']?
>>>
>>> If so I have no idea how to do that...
>>> I assume that there is a PHP command to help but I have not been using such ever
>>> so I don't know.
>>>
>> No, $_SERVER['DOCUMENT_ROOT'] is a string, just echo out what it
>> actually is on both versions of PHP. That would show you what you now
>> know, that it's different for whatever reason. It could be a script
>> being run that's altering it, it could be a change in server config, not
>> easy to tell without more digging.
> Does it matter if I use
> $_SERVER["DOCUMENT_ROOT"] rather than
> $_SERVER['DOCUMENT_ROOT']
>
> In the code I am struggling with it uses double quotes rather than single quotes
> as you show here,
>
The only difference between single and double quote is how PHP handles 
string interpolation, e.g.:

$var = 'something';
echo "this is $var";
echo 'this is $var';

Will give you the output:

this is something
this is $var

-- 
Ashley Sheridan
https://www.ashleysheridan.co.uk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.