title: PHP Function not working when run from server
body: <p>When i run this code on a local server it works fine, but if i run it on my domain it does not work, and i dont understand why.</p>
  
  <p>I have tried to comment out sections on the page and it seems to crash when i define the <code>'siteTitle()'</code> function. Here is the code up until the point it crashes:</p>
  
  <h2>    index.php</h2>
  
  <pre><code>&lt;?php
      include('functions.php');
      varSet();
      if (include('pages/'.$pageID.'.php')) {
          // DO NOTHING
      } else {
          require('404.php');
      }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html lang="no"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8" /&gt;
          &lt;title&gt;&lt;?php siteTitle('Obsidian.no', true, ' | '); ?&gt;&lt;/title&gt;
  </code></pre>
  
  <h2>    functions.php</h2>
  
  <pre><code>&lt;?php
  
  // Functions requierd by ~/index.php
  
      function isOnline() {
          if (preg_match('/::1$/', $_SERVER['SERVER_ADDR']) || $_SERVER['SERVER_ADDR']=='127.0.0.1') {
              return 0;
          } else if (preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $_SERVER['SERVER_ADDR'])) {
              return 1;
          } else {
              return false;
          }
      }
  
      function varSet() {
  
      //  User-defined Globals goes here:
  
          // Set IP-variables
  
          $cIP = $_SERVER['HTTP_CLIENT_IP'];
          $xIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
          $rIP = $_SERVER['REMOTE_ADDR'];
  
          if (!empty($cIP)) {
              $usrIP = $cIP;
          } else if (!empty($xIP)) {
              $usrIP = $xIP;
          } else {
              $usrIP = $rIP;
          }
  
          // Set $root
  
          if (isOnline()) {
              $root = $_SERVER['DOCUMENT_ROOT'].'/design8';
          } else {
              $root = $_SERVER['DOCUMENT_ROOT'];
          }
  
  
          // Set $pageID
  
          if (isset($_GET['pageid'])&amp;&amp;!empty($_GET['pageid'])) {
              $pageID = $_GET['pageid'];
          } else {
              $pageID = 'home';
          }
  
          // Make Globals
  
          $GLOBALS['cIP'] = $cIP;
          $GLOBALS['xIP'] = $xIP;
          $GLOBALS['rIP'] = $rIP;
          $GLOBALS['usrIP'] = $usrIP;
  
          $GLOBALS['root'] = $root;
  
          $GLOBALS['pageID'] = $pageID;
  
      }
  
      function siteTitle($title, $displayPageName = true, $separator = ' | ') {
          global $root;
          global $pageID;
          if (get_required_files()['2']==$root.'/404.php') {
              echo($title.$separator.'Page not found (Error: 404)');
          } else {
              if ($displayPageName) {
                  echo($title.$separator.ucwords($pageID));
              } else  {
                  echo($title);
              }
          }
      }
  </code></pre>
  
  <p>I am aware that not all html and php tags are closed here, but thats because this is just the parts that run before the crash. If the <code>'siteTitle()'</code> function is not commented out in functions.php, it crashes at <code>'require('functions.php')'</code>. And if it is in comment it obviously crashes when the function is called in index.php.</p>
  
  <p>However the site runs perfectly on MAMP localhost, but not from my domain hosted by one.com.</p>
  
  <p>Thanks for any answers !</p>
  
  <p>(<code>404.php</code> is irrelevant, as it does not contain anything)</p>
  
  <p>The PHP version on the server is 5.6.3, and 5.6.2 on the localhost.</p>