title: PHP script throwing internal server error 500, fixed when turning on display_errors
body: <p>I came across an issue today, that my PHP script would send a server error 500 upon finishing (on apache). The code was something like: </p>
  
  <pre><code>//many stuff here that work
  echo "It reached here";
  exit;
  </code></pre>
  
  <p>and I was always reaching the point before the exit; command. Doing a google search, I came across <a href="http://www.infotales.com/php-script-throwing-internal-server-error-500/" rel="nofollow noreferrer">this post</a>, which suggested turning on display_errors. I did it and the 500 error went away. </p>
  
  <p>So I wanted to ask, does anyone have an explanation on why this happens? This <a href="https://stackoverflow.com/questions/1184001/weird-500-internal-server-error-firebug-php-display-errors-ajax">SO post</a> describes a similar case, but there are no explanations.</p>
  
  <p>As always, thanks in advance</p>