title: 500 (Service unavailable (with message))
body: <p>I trying to call <code>db_update()</code> after sending jquery post, so I need to include drupal_bootstrap to use Drupal functions, here is my code :</p>
  
  <p>MyModuleAPI.php </p>
  
  <pre><code>if (!defined('DRUPAL_ROOT')) {
      define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']. 'mysite');
      chdir(DRUPAL_ROOT);
  }
  include_once(DRUPAL_ROOT.'/includes/bootstrap.inc');
  drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
  
  function set_server($host,$port){
  
          db_update('server')...
                      -&gt;execute();
       ...
  }
  
  $query = isset($_POST['query']) ? $_POST['query']: null;
  $params = isset($_POST['params']) ? $_POST['params']: null;
  
  switch ($query)
  {   case "set_server" :
         ...
          set_server($host,$port);
          break;
  
  }
  </code></pre>
  
  <p>MyModuleAjax.js</p>
  
  <pre><code>function ajax_set_server(serverHost,serverport){
      var pathUrl="path/to/includes/MyModuleAPI.php";
  
          jQuery.ajax({
              type: "POST",
              url: pathUrl,
              data: {query: "set_server", params:[serverHost,serverport]},
              success: function (response) {                
                  console.log("set server resp "+response);
                  return false;
              }
          });
  }
  </code></pre>
  
  <p>My problem is when sending the request I get:</p>
  
  <pre><code>POST http://localhost/path/to/includes/MyModuleAPI.php 500 (Service unavailable (with message))
  </code></pre>
  
  <p>I don't know if the problem is from including bootstrap or if it is already legal there. Any help please.</p>