title: How to configure PHP server variable $_SERVER['DOCUMENT_ROOT']?
body: <p>[Asked <a href="https://superuser.com/q/1134913/8986">this at SU;</a> suggestion there was to repost at SO]</p>
  
  <p>We have PHP programs that use $_SERVER['DOCUMENT_ROOT'] as a path to a place where we can place a private directory (using a unique name) in a safe, known place on server.   This directory holds data summaries collected from multiple perhaps thousands of served PHP pages; this summary has no impact on the main functionality of the pages served, and eventually can be ignored or deleted.  While it exists, a PHP-based tool can inspect the summary data and provide a report.</p>
  
  <p>This has worked well on a variety of PHP servers, and appears to be "automatically" (?) set according to the <a href="http://php.net/manual/en/reserved.variables.server.php" rel="nofollow noreferrer">PHP Manual documentation</a>:</p>
  
  <blockquote>
    <p>'DOCUMENT_ROOT'</p>
  
  <pre><code>   The document root directory under which the current script
     is executing, as defined in the server's configuration file.
  </code></pre>
  </blockquote>
  
  <p>We installed several different PHP servers over the years, and they all seem to come with this pre-configured to a reasonable path without any explicit configuration effort on our part.  </p>
  
  <p>We have some clients using our software that complain that this path seems to be set to null, which seems inconsistent with the above definition.  (Does null signify some special path?)  (One of these clients claims they have (php -v) "PHP 5.6.16-3+deb.sury.org~trusty+1 (cli) ... Zend Engine v2.6.0, ... with Zend OPcache v7.0.6-dev, ..." and (uname -or) "3.19.0-25-generic GNU/Linux" [??Generic GNU/Linux??]</p>
  
  <p>Pardon my ignorance, but is DOCUMENT_ROOT a configurable item?  Where do I find the server "configuration file" for this? Is it the same place for all different PHP server implementations?  Can I/should I change that configuration files to set this explicitly if it is not set?</p>
  
  <p>If not, is there another way to provide a path to a safe long-term "temporary" local directory?</p>