Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3310144
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:43:28+00:00 2026-05-17T21:43:28+00:00

Why is that the SQL Server PHP Driver has problms with long running queries?

  • 0

Why is that the SQL Server PHP Driver has problms with long running queries?

Every time I have a query that takes a while to run, I get the following errors from sqlsrv_errors() in the below order:

Shared Memory failure, Communication
Link Failure, Timeout failure

But if I try the same query with SQLCMD.exe it comes back fine. Does the PHP SQL Server Driver have somewhere that a no timeout can be set?

Whats the difference between running queries via SQLCMD and PHP Driver?

Thanks all for any help

Typical usage of the PHP Driver to run a query.

function already_exists(){

    $model_name = trim($_GET['name']);

    include('../includes/db-connect.php');

    $connectionInfo = array('Database' => $monitor_name);

    $conn = sqlsrv_connect($serverName, $connectionInfo);

    $tsql = "SELECT model_name FROM slr WHERE model_name = '".$model_name."'";

    $queryResult = sqlsrv_query($conn, $tsql);

    if($queryResult != false){

        $rows = sqlsrv_has_rows($queryResult);

        if ($rows === true){

             return true;

        }else{

            return false;
        }

    }else{

           return false;         
    }

    sqlsrv_close($conn);

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:43:28+00:00Added an answer on May 17, 2026 at 9:43 pm

    SQLCMD has no query execution timeout by default. PHP does. I assume you’re using mssql_query? If so, the default timeout for queries through this API is 60 seconds. You can override it by modifying the configuration property mssql.timeout.

    See more on the configuration of the MSSQL driver in the PHP manual.

    If you’re not using mssql_query, can you give more details on exactly how you’re querying SQL Server?

    Edit [based on comment]
    Are you using sqlsrv_query then? Looking at the documentation this should wait indefinately, however you can override it. How long is it waiting before it seems to timeout? You might want to time it and see if it’s consistent. If not, can you provide a code snippet (edit your question) to show how you’re using the driver.

    If MSDTC is getting involved (and I don’t know how you can ascertain this), then there’s a 60-second timeout on that by default. This is configured in the Component Services administration tool and lives in a different place dependent on version of Windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that Sql Server has some handy built-in quarterly stuff, but what about
Is there a limitation in the length of a query that SQL Server can
We have an application that installs SQL Server Express from the command line and
I have stored procedures in SQL Server T-SQL that are called from .NET within
It appear that SQL Server like most other products Random Function really is not
I am told that SQL Server 2005 installation with BI tools and SQL Server
Here , it is said that Sql Server Compact allows up to 256 connections.
I'm looking for a way to poll different servers and check that SQL server
I know that a SQL Server full text index can not index more than
I inherited a project that uses SQL Server 200x, wherein a column that stores

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.