Answers.Body: <p>The problem was PHP files weren't being processed. I reinstalled PHP module using the following commands and it worked.</p>
  
  <pre><code>sudo /etc/init.d/apache2 stop
  sudo apt-get remove --purge apache2 php5
  sudo apt-get remove --purge libapache2-mod-php5
  sudo apt-get install php5 apache2 libapache2-mod-php5
  sudo /etc/init.d/apache2 start
  sudo a2enmod php5
  sudo /etc/init.d/apache2 force-reload
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-07T00:35:17.600Z
Answers.LastActivityDate: 2016-03-07T00:35:17.600Z
Answers.UserDisplayName: Dilip Raj Baral
Body: <p>The setup ran smoothly until <em>amp test</em> which says:</p>
  
  <pre><code>$ amp test
  
  Expect response: "response-code-SoYwxYyBvx"
  Received incorrect response: "&lt;?php
  // This is a simple script which outputs "OK" if it
  // executes correctly and connects properly to a database.
  
  if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array(
      '127.0.0.1',
      '::1',
    ))
  ) {
    header('HTTP/1.0 403 Forbidden');
    exit('Connection must originate on localhost');
  }
  
  $config = require 'config.php';
  $errors = array();
  
  // ---------- Test HTTP inputs ----------
  
  if (!isset($_REQUEST['exampleData']) || $_REQUEST['exampleData'] !== 'foozball') {
    $errors[]= "Error: Expected GET or POST value 'exampleData=foozball'";
  }
  
  // ---------- Test database ----------
  
  try {
    $dbh = new \PDO($config['dsn'], $config['user'], $config['pass']);
    $dbh-&gt;setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
    foreach ($dbh-&gt;query('SELECT 99 as value') as $row) {
      if ($row['value'] == 99) {
        // ok
      } else {
        $errors[] = "Error: Bad query result &lt;br/&gt;";
      }
    }
    $dbh = NULL;
  } catch (PDOException $e) {
    $errors[] = "Error: " . $e-&gt;getMessage() . "&lt;br/&gt;";
  }
  
  // ---------- Test file permissions ----------
  
  $dataFile = $config['dataDir'] . '/example.txt';
  if (FALSE === file_put_contents($dataFile, "data")) {
    $errors[] = "Error: Failed to write $dataFile";
  }
  if (FALSE === unlink($dataFile)) {
    $errors[] = "Error: Failed to remove $dataFile";
  }
  
  // ---------- Wrap up ----------
  
  if (empty($errors)) {
    echo "response-code-SoYwxYyBvx";
  }
  else {
    echo implode("\n", $errors);
    die();
  }"
  Tip: Try running "amp config" and/or restarting the webserver.
  </code></pre>
  
  <p>I believe I have set up <code>amp config</code> correctly. I even edited <em>apache2.conf</em> and included the line it asked to. But no matter how much I restart and test, it doesn't work.</p>
  
  <p>My <code>amp config</code>:</p>
  
  <pre><code>mysql_dsn : mysql:civicrm:civicrm@localhost:8000
  perm_type : linuxAcl
  perm_user : www-data
  httpd_type : apache24
  </code></pre>
  
  <p>And I included this line <code>Include /root/.amp/apache.d/*.conf</code> in <em>apache2.conf</em> file.</p>
  
Tags: <civicrm-buildkit>
Title: Buildkit - amp test fails - incorrect response received
ThreadText: # Buildkit - amp test fails - incorrect response received
  
  (Asked by: username_0 on 2016-03-07)
  
  The setup ran smoothly until amp test which says:
  $ amp test
  
  Expect response: "response-code-SoYwxYyBvx"
  Received incorrect response: "setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
    foreach ($dbh->query('SELECT 99 as value') as $row) {
      if ($row['value'] == 99) {
        // ok
      } else {
        $errors[] = "Error: Bad query result ";
      }
    }
    $dbh = NULL;
  } catch (PDOException $e) {
    $errors[] = "Error: " . $e->getMessage() . "";
  }
  
  // ---------- Test file permissions ----------
  
  $dataFile = $config['dataDir'] . '/example.txt';
  if (FALSE === file_put_contents($dataFile, "data")) {
    $errors[] = "Error: Failed to write $dataFile";
  }
  if (FALSE === unlink($dataFile)) {
    $errors[] = "Error: Failed to remove $dataFile";
  }
  
  // ---------- Wrap up ----------
  
  if (empty($errors)) {
    echo "response-code-SoYwxYyBvx";
  }
  else {
    echo implode("\n", $errors);
    die();
  }"
  Tip: Try running "amp config" and/or restarting the webserver.
  
  I believe I have set up amp config correctly. I even edited apache2.conf and included the line it asked to. But no matter how much I restart and test, it doesn't work.
  My amp config:
  mysql_dsn : mysql:civicrm:civicrm@localhost:8000
  perm_type : linuxAcl
  perm_user : www-data
  httpd_type : apache24
  
  And I included this line Include /root/.amp/apache.d/*.conf in apache2.conf file.
  
  **Tags:** civicrm-buildkit
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-03-07. Score: 3
  
  The problem was PHP files weren't being processed. I reinstalled PHP module using the following commands and it worked.
  sudo /etc/init.d/apache2 stop
  sudo apt-get remove --purge apache2 php5
  sudo apt-get remove --purge libapache2-mod-php5
  sudo apt-get install php5 apache2 libapache2-mod-php5
  sudo /etc/init.d/apache2 start
  sudo a2enmod php5
  sudo /etc/init.d/apache2 force-reload
  
  
  ---
  
  