Troubleshooting 500 (Internal Server Error)

Troubleshooting 500 (Internal Server Error)

alksjdljsaldlsaalksjdljsaldlsa Posts: 2Questions: 1Answers: 0

Chrome's Dev Tool is reporting the following error:
GET http://mylonginternalURL/resources/scripts/php/hardware_report.php?_=1412778574870 500 (Internal Server Error)

Here is a link to DataTables Live w/ my JavaScript code: http://live.datatables.net/bagumulo/1/

I cannot for the life of me figure out what the issue is. I had this code working a month ago but had to table it and upon returning, I cannot figure out what is wrong.

Any guidance would be appreciated.

Answers

  • alksjdljsaldlsaalksjdljsaldlsa Posts: 2Questions: 1Answers: 0
    edited October 2014

    Here is my PHP Script:

    <?php
    // This is for SQL Authentication. I've added instructions if you are using Windows Authentication

    // Uncomment this line for troubleshooting / if nothing displays
    ini_set('display_errors', 'On');

    // Server Name
    $myServer = "SERVER";

    // If using Windows Authentication, delete this line and the $myPass line as well.
    // SQL Server User that has permission to the database
    $myUser = "UNAME";

    // SQL Server User Password
    $myPass = "PWORD";

    // Database
    $myDB = "DATABASE";

    // If using Windows Authentication, get rid of, "'UID'=>$myUser, 'PWD'=>$myPass, "
    // Notice that the latest driver uses sqlsrv rather than mssql
    $conn = sqlsrv_connect($myServer, array('UID'=>$myUser, 'PWD'=>$myPass, 'Database'=>$myDB));

    // Change TestDB.vwTestData to YOURDB.dbo.YOURTABLENAME
    $sql ="SELECT name FROM DATABASE where name";
    $data = sqlsrv_query($conn, $sql);

    $result = array();

    do {
    while ($row = sqlsrv_fetch_array($data, SQLSRV_FETCH_ASSOC)){
    $result[] = $row;
    }
    }while ( sqlsrv_next_result($data) );

    // This will output in JSON format if you try to hit the page in a browser
    echo json_encode($result);

    sqlsrv_free_stmt($data);
    sqlsrv_close($conn);

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    Check the server error log is always the first step for a 500 error.

    Allan

This discussion has been closed.