/    Sign up×
Community /Pin to ProfileBookmark

Connection from php to sql server 2005 database using sqlsrv_connect()

Good day!

After connecting my php to sql server 2005 using the mssql_connect() syntax, which did not work. I try my best that I can to work it, but at the end I could not fix the error. So now, I try another option like I used Microsoft Driver for SQL Server and the syntax that I’m using is sqlsrv_connect()

Here are some configurations that I do to work the connection

  • 1. I put the php folder in in C:

  • 2. I configure my IIS 6.0 to run php using isapi

  • 3. I installed the SQLSRV20.EXE inC:phpext

  • 4. I configure my php.ini
    I uncommented the ff:
    extension_dir = “./ext”
    cgi.force_redirect = 0
    doc_root = “C:Inetpubwwwroot”
    I add extension=php_sqlsrv_53_ts_vc9.dll
  • I create a php file to test the connection

    [code=php]
    <?php
    $server = “ISMSQLEXPRESS”;
    $connectOptions = array(“Database” => “dbtest”);
    //Because UID and PWD are not specified in the connection option
    //The connection is made with Windows Authentication.
    if($conn)
    {
    echo “Connection established”;
    }
    else
    {
    echo “Connection could not be established”;
    }
    ?>
    [/code]

    After I run this code I got an error like this:

    Fatal error: Call to undefined function sqlsrv_connect() in C:Inetpubwwwroottestconn.php on line 5

    I don’t know where is the problem and how can I fix it.

    I need to fix it as soon as possible, because almost 3 weeks I troubleshoot this connection.

    Any help is highly appreciated
    Thank you in advance.

    to post a comment
    PHP

    0Be the first to comment 😎

    ×

    Success!

    Help @rhodarose spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...