Do You Support $_Server['DOCUMENT_ROOT'] ?

$_Server['DOCUMENT_ROOT'] is referring to doc_root value in php.ini which is currently set to null as IIS is not returning the value. This value can only be set if the domain is hosted under a dedicated server. In addition to the security consideration, if this value is set, it will applied to to server wide. All other users who used this variable in their PHP application will be referring to a dedicated domain physical path set in the php.ini allowing other users to query the files listed on your domain.
 
You may use the 'PATH_TRANSLATED' predefined variable which will return the translated path to the current script. However, this predefined variable does not return the DOCUMENT_ROOT path.
 
You may create a sample php file in your web folder (public_html for Linux and wwwroot for Windows) with the following scripts and browse it from the web browser to get the value:
 
<?php
echo $_SERVER['PATH_TRANSLATED'];
?>

Add Feedback