title: Hosting web (Hello World) in Google Compute Engine VM (free trial) + Apache + Ajax + php + javascript
body: <p>The implementation on Google Compute Engine VM (free trial) of Hello World has the following files:</p>
  <p>index.php</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;PHP Test&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
      function create () {
          $.ajax({
              url:&quot;firestoreData.php&quot;,    //the page containing php script
              type: &quot;POST&quot;,    //request type,
              success:function(result){
                  console.log(result);
              },
              error: function(jqxhr, status, exception) {
                  console.log(&quot;error:&quot; + exception);
              }
          });
      }
  &lt;/script&gt;
  &lt;button type=&quot;button&quot; onclick=&quot;create()&quot;&gt;Click Me&lt;/button&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>firestoreData.php:</p>
  <pre><code>&lt;?php
  return &quot;hello world&quot;;
  </code></pre>
  <p>The problem is that the response of Ajax is the content of the php file:</p>
  <pre><code>&lt;?php
  return &quot;hello world&quot;;
  </code></pre>
  <p>See the image[1]</p>
  <p>I've tried with several ways of php files with the same result:</p>
  <pre><code>&lt;?php
  echo &quot;hello world&quot;;
  ?&gt;
  </code></pre>
  <p>...</p>
  <pre><code>&lt;?php
  echo &quot;hello world&quot;;
  exit;
  </code></pre>
  <p>...
  [1]: <a href="https://i.stack.imgur.com/qbpWb.png" rel="nofollow noreferrer">https://i.stack.imgur.com/qbpWb.png</a></p>