0

The setup ran smoothly until amp test which says:

$ amp test

Expect response: "response-code-SoYwxYyBvx"
Received incorrect response: "<?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->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 <br/>";
    }
  }
  $dbh = NULL;
} catch (PDOException $e) {
  $errors[] = "Error: " . $e->getMessage() . "<br/>";
}

// ---------- 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.