On 13/09/2021 20:14, Bo Berglund wrote:
Have you looked at __DIR__ ?
I have a website that was created years ago with PHP handlers for database
access etc. After upgrading the webhotel PHP version to 7.0 from 5.3 the site
The main php file store is in htdocs/php but there are other places where these
files are referred to as includes using this syntax:
include ($_SERVER["DOCUMENT_ROOT"] . '/php/appdbdata.php');
And these includes are used in many places at different folder depths in the
But now the only way I have found to handle this is to use relative paths and it
does not work well for files that are moved between directories.
What can I use in PHP 7 in order to include php files relative to document root?
I have tried googling but I always get to hardcodes solutions which is not good
when files are in different directories.
For the php files residing inside /php I simply replaced the construct with
THen seemingly all worked, but only until a call was made to a php file at a
deeper location which also included this file...