在localhost小屋上运行的页面不在远程linux服务器上

时间:2017-03-16 12:51:45

标签: php mysql linux server

我在代码部分下面的代码在localhost(apache2)中运行良好,但在远程服务器上没有响应,超时后说内部服务器错误500.即使我添加了错误报告位,也看不到任何内容。

提前

ThanX

<?php
header('Content-Type: application/json');
error_reporting(E_ALL);
ini_set('display_errors', 1); 
/*----------Code to filter data from the db server dynamically-------------*/
/*----------error reporting  Initialization-------------*/
$servername = "";
$username = "";
$password = "";
$dbname = "graph";

$mysqli = new mysqli($servername, $username, $password, $dbname);
if(!$mysqli){
    die("Connection failed: " . mysqli_connect_error());
    /*----------Creating Connection With DB // For left side graph(c\t)-------------*/
}

else 

{
    $query ="select id from batteryinfo order by id asc limit 1";
    $r = mysqli_query($mysqli, $query) or die("unable to connecr to server");
    $row = mysqli_fetch_assoc($r);
    $fid=$row['id'];
    $query ="select id from batteryinfo order by id desc limit 1";
    $r = mysqli_query($mysqli, $query) or die("unable to connecr to server");
    $row = mysqli_fetch_assoc($r);
    $lid=$row['id'];
    /*----------Query to select first and last inserted row id-------------*/

    $data = array();
    $count=0;
    while($fid<=$lid ) {
        $nid=$fid;
        $nid=$nid+1;
        $query = sprintf("SELECT current, soc, blockvoltage 
                          FROM batteryinfo AS fi 
                          WHERE id ='$nid' 
                            AND (SELECT round(current, 1) = round(fi.current, 1) 
                                || round(soc, 1) = round(fi.soc, 1) 
                                || round(blockvoltage, 3) = round(fi.blockvoltage, 3) 
                                FROM batteryinfo 
                                WHERE id ='$fid'
                                )
                        ");
        $result = $mysqli->query($query);
        /*----------Query to select current, soc, blockvoltage after stisfying condition-------------*/
        foreach($result as $row) {
            $data[] = $row;
            $count++;
        }
        $fid=$fid+"1";
    }           
    $result -> close();
    $mysqli-> close();
    echo"Total".$count."End";
    print json_encode($data);
}
//////////////////////////////fid=first row, lid=last row, nid=fid+1 (next id )//////////////////////////////////////
?>

0 个答案:

没有答案