title: PHP - Output is correct in HTML but browser give 500 Internal server Error
body: <p>Heads Up! Just starting out in PHP so I apologize in advance if this is some sort of n00b error. I have a little script in PHP which reads a table from a MySQL database and provides the values of a single column as a drop-down list. The PHP code is as follows:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
  &lt;?php
      $dbc = mysql_connect("localhost", "someDBuser", "somecorrectpass");
      $db = mysql_select_db("someDB");
      $results= mysql_query("SELECT name FROM sometable");
  ?&gt;
  &lt;select name="eventid"&gt;
      &lt;option value="0"&gt;Choose&lt;/OPTION&gt;
      &lt;?php
          while($row = mysql_fetch_array($results)) {
              echo '&lt;option value="'.$row['name'].'"&gt;'. $row['name'].'&lt;/option&gt;';
          }
      ?&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Now when I call the file from the browser, I get a Blank Screen. I enabled PHP Error reporting and get the following error <code>Fatal error: Call to undefined function mysql_connect() in /var/www/html/testdel.php on line 12</code>.</p>
  
  <p>Next I tried running the file in the backend using the PHP command. It ran fine and gave me the required html output like so:</p>
  
  <pre><code>$ php /var/www/html/testdel.php
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="post" action="/var/www/html/testdel.php"&gt;
  &lt;select name="eventid"&gt;
      &lt;option value="0"&gt;Choose&lt;/OPTION&gt;
      &lt;option value="Ex1005"&gt;Ex1005&lt;/option&gt;&lt;option value="Ex1009"&gt;Ex1009&lt;/option&gt;&lt;option value="user1"&gt;user1&lt;/option&gt;&lt;/select&gt; 
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And when I put this output in a file (say "testdel.html", for example), I get the correct output.</p>
  
  <p>What am I doing wrong in the original PHP file? Is it something related to permissions? The current file permissions are 644. Or do I need to include(use) some module?</p>