title: PHP: Identifying the local server consistently
body: <p>I have a single code base which I am deploying to multiple servers.</p>
  
  <p>I need to identify which server the code is running on in order to use the correct configuration information for the database and so on.</p>
  
  <p>I initially tried using the DOCUMENT_ROOT and checking for the account name.</p>
  
  <pre><code>if (strpos($_SERVER['DOCUMENT_ROOT'], '/var/www/vhosts/SOMETHING.com/') !== false)
  { //is a specific server }
  </code></pre>
  
  <p>This works well, however I discovered that when my cron jobs are executed DOCUMENT_ROOT is empty, when initiated from Plesk.</p>
  
  <p>Does a better way exist to identify the server?</p>
  
  <p>I do not wish to have a server specific configuration file because the FTP sync software which ensures all files are the same across all servers does not support  excluding some files.</p>
  
  <p>Plus, the servers may be running different control panels and setups, so I wish something as general as possible.</p>