title: Ajax request returns POST <<url>> 500 (Internal Server Error)
body: <p>I've been doing this module for a website using WAMP Server and everything works, but when I upladed it to the website server it always returns Error 500.</p>
  
  <p><a href="https://i.stack.imgur.com/fPpYt.png" rel="nofollow noreferrer">Error 500 1</a></p>
  
  <p><a href="https://i.stack.imgur.com/4Zjuq.png" rel="nofollow noreferrer">Error 500 2</a></p>
  
  <p>When the main page index.php loads (using Javascript .ready function) it send an ajax request to 'obtenermunicipio.php'.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $( document ).ready(function() {
          $.ajax({
            type: 'POST',
            url: '../obtenermunicipio.php',
            data : {'valor':'paz'},
            dataType: 'json',
            success: function(data) {
              if(data.length &lt;= 0) {
                return;
              }
              for(var i=0; i &lt; data.length; i++) {
                  var opcion = document.createElement('option');
                  opcion.innerHTML+=data[i];
                  document.getElementById('unidadmedica').appendChild(opcion);
              }
            },
            error: function(e) {
              console.log(e.message);
            }
          }); 
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>The page 'obtenermunicipio.php' receive the value 'valor' and made an MySQL query to obtain an array data that it's return.</p>
  
  <pre><code>&lt;?php
      include($_SERVER['DOCUMENT_ROOT'].'/Noticias/conexion.php');
      header('Content-Type: text/html; charset=ISO-8859-15');
      header("application/json");
      $conexion=conectar();
      $municipio = utf8_decode($_POST['valor']);
      if($municipio != "loret")
          $sql = "SELECT DISTINCT unidadmedica FROM `unidadesmedicas` WHERE municipio like '%".$municipio."%' AND localidad NOT LIKE '%loret%'";
      else
          $sql = "SELECT DISTINCT unidadmedica FROM `unidadesmedicas` WHERE localidad like '%".$municipio."%'";
      $rs = mysql_query($sql) or die(mysql_error($conexion)); 
      $fila = mysql_fetch_all($rs);
      print json_encode($fila);
  ?&gt;
  </code></pre>
  
  <p>any ideas of how to solve it? it works fine on Wamp.</p>