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

[email protected] (AllenJB)
Newsgroups php.general
Message-ID <[email protected]>
On 14/09/2021 08:57, Bo Berglund wrote:
> And the result comes out like this:
> 1. curdir: /data/25/2/158/91/2484743/user/2721122/htdocs/log
> 2. docroot: /usr/services/vux/apache/htdocs
> 3. phpdir: /usr/services/vux/apache/htdocs/php

To account for symlinks (which allow you to pretend a file or directory 
is in another place on the filesystem), run each path through realpath() 
(I believe __DIR__ is already resolved for its "real path", but it 
doesn't hurt to run it through again in this case to be sure)

The curdir value smells to me like some sort of admin panel (similar to 
cpanel setup) that may be using chroot or containers. In this case it 
may be better to consult a forum or mailing list specific to this admin 
panel software - they're more likely to know why this discrepency exists 
and how you should account for it.
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.