php access to ms sql server

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Ideas Centre
Post Reply
jacknomiz
Registered User
Posts: 2
Joined: Fri Dec 21, 2018 4:53 am

php access to ms sql server

Post by jacknomiz » Fri Dec 21, 2018 5:19 am

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/co ... erver-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.

User avatar
AmigoJack
Registered User
Posts: 5479
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: php access to ms sql server

Post by AmigoJack » Fri Dec 21, 2018 8:32 am

This is a board about phpBB, not PHP.

As per the manual you might miss "Microsoft SQL Server 2012 Native Client".
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

jacknomiz
Registered User
Posts: 2
Joined: Fri Dec 21, 2018 4:53 am

Re: php access to ms sql server

Post by jacknomiz » Fri Dec 21, 2018 8:49 pm

I see, thanks for your quick reply, sorry didn't know. Cheers.

Post Reply

Return to “phpBB Discussion”

Who is online

Users browsing this forum: bubbathegimp, WalterM and 18 guests