title: moodle Unexpected token < in JSON at position 0 when selecting site administration
body: <p>We just migrated a moodle site and for the most part everything is working well except the admin link site administration.  Once it is clicked, it will go on spinning for 3 minutes until it timeouts with a 500 error and an error message <code>Unexpected token &lt; in JSON at position 0</code>.  Here is the console output:</p>
  
  <pre><code>moodle/lib/ajax/getsiteadminbranch.php 500 (Internal Server Error)
  </code></pre>
  
  <p>I disabled JS to get debug turned on but wasn't able to replicate the bug until I logged out and logged back in (JS turned on).  </p>
  
  <p>Replicating the steps above, I got a more verbose console log</p>
  
  <p><a href="https://i.stack.imgur.com/vlUM4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vlUM4.png" alt="Chrome JS console with verbose moodle js notifications"></a></p>
  
  <p>It seems to get hung up on</p>
  
  <pre><code>moodle-block_navigation: Loading navigation branch via AJAX: siteadministration
  </code></pre>
  
  <p>Here is the stack trace:</p>
  
  <blockquote>
    <p>SyntaxError: Unexpected token &lt; in JSON at position 0    at JSON.parse >()<br>
    at Object.Y.namespace.parse (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:37340:18" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:37340:18</a>)<br>
    at BRANCH.ajaxProcessResponse (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?m/1477092989/block_navigation/navigation/navigation-debug.js:653:33" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?m/1477092989/block_navigation/navigation/navigation-debug.js:653:33</a>)<br>
    at Y.Subscriber._notify (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26572:35" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26572:35</a>)<br>
    at Y.Subscriber.notify (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26601:24" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26601:24</a>)<br>
    at Y.CustomEvent._notify (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26264:17" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26264:17</a>)<br>
    at Y.CustomEvent._procSubs (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26390:36" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26390:36</a>)<br>
    at Y.CustomEvent.fireSimple (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26357:18" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26357:18</a>)<br>
    at Y.CustomEvent._fire (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26339:29" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:26339:29</a>)<br>
    at IO.fire (<a href="https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:27492:22" rel="nofollow noreferrer">https://foo-bar.io/moodle/theme/yui_combo.php?rollup/3.13.0/yui-moodlesimple.js:27492:22</a>) </p>
  </blockquote>
  
  <p>The code worked on the old environment but obviously I am still missing something in the new one. Any assistance would be appreciated.</p>