开发者

PHP Script works on laptop but not server

开发者 https://www.devze.com 2022-12-09 17:07 出处:网络
I make an AJAX GET request to a PHP script to compare a value in a textfield to one in a database on every character开发者_Go百科 typed - this works smoothly and beautifully on my laptop (Windows).

I make an AJAX GET request to a PHP script to compare a value in a textfield to one in a database on every character开发者_Go百科 typed - this works smoothly and beautifully on my laptop (Windows).

I transfer my scripts to computer running windows server 2003 and it tries to make a GET request but it returns a "500 Internal Server Error"?!

What is going on? The PHP script is the following:

include('includes/db-connect.php');
$connectionInfo = array( 'Database' => 'TYn_Motor');
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if($conn){
    $tsql = "SELECT * FROM Monitor_User_Session WHERE Session_ID = '".$_GET['session_id']."'";
    $stmt = sqlsrv_query($conn, $tsql);
    if($stmt !== null)  {
        if(sqlsrv_has_rows($stmt) === false){
            echo '0';           
        }else{
            echo '1';
        }
    }else{
        echo '1';
        //die( print_r( sqlsrv_errors(), true));
    }
}else{
       echo '1';
     //echo 'Database Connection could not be Established';  
}
sqlsrv_close($conn);

Can anyone see what could be causing the problem?

The includes is just one line - the variable $serverName is set. I am running PHP 5.3.0 on my laptop, the server is running PHP 5.2.9.


If the production server has display_errors set to off, then it's possible that a regular PHP error is thrown (e.g. an extension is missing), but nothing is displayed. Try placing ini_set('display_errors', true) at the very beginning of your script.

0

精彩评论

暂无评论...
验证码 换一张
取 消