Question: I know what causes a PHP page to consistently download instead of running normally, but I have no idea why it would only sometimes download and sometimes run normally. It appears to be purely random: I just keep hitting Refresh until it stops trying to download and runs normally.

This page has a lot of jQuery/AJAX scripting running on it. Several AJAX requests are made as soon as the page loads. These are all called after the "DOM load" event, rather than when the window is ready. Does that make a difference? Could all these requests happening on the page load cause it to randomly fail to run normally?

Answer: 
At the top of your php page

```
<?php
    header('Content-Type: text/html');

```

Should do the trick. The problem is that the wrong MIME Type is being sent over, confusing your browser to the point that it doesn't know what do do with it so it just downloads it.
I've seen this happen if your script crashes the PHP interpreter. Apart from finding the cause of the crash, I'm not sure what you can do.