Search code examples
phpiisglobal-variablesmissing-features

PHP7 IIS missing $_SERVER['DOCUMENTROOT']


I have recently upgraded to PHP7.2.3 running on Windows10 IIS.

One thing that is missing is the $_SERVER['DOCUMENTROOT'] variable. As I use this quite a lot in my web pages I depend on it being set.

Is there a php.ini line that governs the setting or how can I have this set? What are the alternatives?


Solution

  • I discovered that in IIS-10 I had to add "FastCGI settings" module the path to php_cgi.exe. After adding the path the variable $_SERVER['DOCUMENT_ROOT'] is set automatically again by the system