Results 1 to 1 of 1

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

  1. #1
    Join Date
    Jul 2010
    Posts
    228
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default 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:\php\ext
    4. I configure my php.ini
    I uncommented the ff:
    extension_dir = "./ext"
    cgi.force_redirect = 0
    doc_root = "C:\Inetpub\wwwroot"
    I add extension=php_sqlsrv_53_ts_vc9.dll


    I create a php file to test the connection
    PHP Code:
    <?php
    $server 
    "ISM\SQLEXPRESS";
    $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";
    }
    ?>
    After I run this code I got an error like this:

    Fatal error: Call to undefined function sqlsrv_connect() in C:\Inetpub\wwwroot\testconn.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.
    Last edited by rhodarose; 10-08-2010 at 08:41 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •