Recently, I have installed a new Ubuntu server which incorporates PHP7. Previously, on PHP5.3 (or it may have been a later version of PHP5, I could use $_SERVER['HOME']
which returned the home path of the server (i.e. /var/www/). However, this is not possible in PHP7 as $_SERVER['HOME'] is no more.
If I have a site which has a document root of /var/www//httpdocs, how do I get the /var/www/ part. I can not hard code it as my test server (a Synology NAS) does not use PHP7 and can not be upgraded to PHP7 and thus, I need to use a variable that is constant for PHP5 and PHP7 which return the same result to forumate the same result as $_SERVER['HOME'] did in PHP5.
I tried using $_ENV['HOME']
but this appears to print nothing from my system when a simple die($_ENV['HOME']);
is executed.
Can someone put me out of my misery please?
Thanks