500 Internal server error while running sqlsrv_query in PHP RRS feed

  • Question

  • Hello everyone I am having a problem with sqlsrv_query I will be grateful to you please provide some help.

    I am running a query through php:

    $ls_parcel_query = "select  * from  ParcelDetail order by ExtractDate";

    $result = sqlsrv_query($conn, $ls_parcel_query, array(), array("Scrollable"=>"keyset","QueryTimeout"=>300));
    $no_of_rows = sqlsrv_num_rows($result);
    echo "<br/>".$no_of_rows;

    It gives (After 30 seconds):

    500 - Internal server error.

    There is a problem with the resource you are looking for, and it cannot be displayed.

    I have php.ini settings like below:

    max_execution_time = 90

    memory_limit = 128M

    While running this query in SQL SERVER 2008 R2, it successfully gives result in some times in 1 minute and sometimes in 2 minutes.

    • Edited by Vipin-Soni Thursday, April 3, 2014 2:59 PM
    Thursday, April 3, 2014 11:08 AM


All replies

  • Hello,

    A 500 Error will be caused due to many reason.To troubleshooting this issue, you can try to check out the error log and get more information on what is causing the error.
    Reference :
    "500 Internal Server Error" while running PHP
    HTTP Error 500 Internal server for php pages and solution

    Fanny Liu

    Fanny Liu
    TechNet Community Support

    • Proposed as answer by Fanny Liu Monday, April 14, 2014 1:26 PM
    • Marked as answer by Elvis Long Wednesday, May 7, 2014 9:29 AM
    Friday, April 11, 2014 10:13 AM
  • Are you using IIS with FastCGI?

    The default 'Activity Timeout' for a FastCGI application is 30 seconds, and your query is taking longer.

    If so, open IIS Manager (open 'inetmgr'), find 'FastCGI Settings', select your PHP processor and change 'Activity Timeout' to a value long enough for your request.


    Thursday, July 10, 2014 5:19 PM