Php and sql server connection


#1

Hi, I was wondering if you can help please.
I’m a complete newbie to php and got tasked with moving our php app from mysql to sql server 2012.
My env is php 7.0.33 64bit TS running on windows 7, sql server 2012 running on windows.
Running app on localhost via netbeans.

I have downloaded “Microsoft Drivers for PHP for SQL Server” from https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-2017.

Tried 64 bit TS drivers from version 4 to 5.3, ie included them in my php.ini:
extension=php_sqlsrv_7_ts_x64
extension=php_pdo_sqlsrv_7_ts_x64

When I do phpinfo();, all is good - no errors.
So I assumed that sql server extensions loaded ok into php.

My problem is that when I try to open sql server connection, I’m getting this error:
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in …
My code is:
$serverName = “XX.XX.X.XX, 1433”;
$connectionInfo = array( “Database”=>“dbname”, “UID”=>“username”, “PWD”=>“password”,“ReturnDatesAsStrings”=>true);
$db_conn = sqlsrv_connect( $serverName, $connectionInfo);

Can you please point me to the right direction - what am I doing wrong? Are the versions ok?
Any help is much appreciated, thanks in advance.