0

I have a php website hosted in 1and1.com, but when I connect to our local server database(windows server 2012 and sql server 2012) it gives me no luck, it gives me this error:

Call to undefined function sqlsrv_connect() in dbconn.php on line 9.

here's my database connection:

<?php   

    $serverName='xxx.xxx.00.xx'; //<-- should I include PORT here? 
    $connectionInfo=array(
                    'Database'=>'DBName',
                    'UID'=>'userName',
                    "PWD"=>'Password');

    $conn = sqlsrv_connect($serverName,$connectionInfo); //<-- line 9 here

    if($conn){
        //echo 'Connection Established!<br />';
    }else{
        //echo 'Connection Failed!<br />';
        die(print_r(sqlsrv_errors(),TRUE));
    }   

?>

Actually, I'm confused what to use.. like should I use IIS here or other procedures but for development, I used XAMPP to test my website.

I'm new with this kind of stuff, so if you can provide me some step by step articles for this is much more appreciated.

Thanks in advance!

1 Answer 1

2

From the manual:

The SQLSRV extension requires that the Microsoft SQL Server 2012 Native Client be installed on the same computer that is running PHP.

Verify that is installed on your server.

Sign up to request clarification or add additional context in comments.

1 Comment

when I run phpinfo on my website I saw that the PDO driver for sqlsrv is not ENABLED. so it must be enabled first on 1and1?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.