Php AngularJS$http.get请求返回文件

Php AngularJS$http.get请求返回文件,php,mysql,angularjs,Php,Mysql,Angularjs,下面的代码返回实际的php文件,而不是mysql查询的结果 app.controller('customersCrtl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) { var url = "ajax/getCustomers.php"; var response = $http.get(url); response.success(function (data, status

下面的代码返回实际的php文件,而不是mysql查询的结果

app.controller('customersCrtl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) {

    var url = "ajax/getCustomers.php";
    var response = $http.get(url);

    response.success(function (data, status, headers, config) {
        alert(status);
        $scope.list = data;
    });
    response.error(function (data, status, headers, config) {
        alert("AJAX failed!");
    });
getCustomers.php文件是:

<?php
$con=mysqli_connect("localhost","root","","exampledb");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$query="select distinct c.customerName, c.addressLine1, c.city, c.state, c.postalCode, c.country, c.creditLimit from customers c order by c.customerNumber";
$result = $mysqli_query($con, $query);

$arr = array();
if($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $arr[] = $row;  
    }
}
# JSON-encode the response
$json_response = json_encode($arr);

// # Return the response
echo $json_response;  
?>


我正在ubuntu 14.10上使用apache2服务器。请提供帮助。

如果服务器以原始文本返回实际文件时没有出现错误,则服务器可能会出错