IIS servers doesn’t always set the PHP standard variable, $_SERVER[‘DOCUMENT_ROOT’]

How do you set that in one place, your configuration file that you include in all your php programs, so the rest of your code has the document root set like on Apache servers?

Output $_SERVER to see what IS given that you might be able to use:

In this example, the SCRIPT_FILENAME and SCRIPT_NAME are set.

Modify the code below to use what is given to get DOCUMENT_ROOT:

Now you can use $_SERVER[‘DOCUMENT_ROOT’] normally:

Pin It on Pinterest

Share This