Php and sql server connection

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.

I just joined this site because I am having an identical problem, I don’t see a reply here, am I using the site incorrectly? phpinfo shows pdo_sqlsrv so I know the extensions worked, but somehow the entry point (or function) sqlsrv_connect is not included in the php_pdo_sqlsrv_73_ts.dll - I do not know how to list entry points in a dll, I tried dumpbin but didn’t see any names that resemble sql_serv functions - I hope someone gave you an answer – I have been trying to switch from mysql to sql server off and on for a long, long time, but never could get php to access the functions

DO NOT HIJACK SOMEONE ELSES THREAD.

Start your own.

Sponsor our Newsletter | Privacy Policy | Terms of Service