i.n.n.m
i.n.n.m

Reputation: 3046

Microsoft Driver for SQL Server 2016 - Installation

My question is based off of this post's answer from @Crontab. I downloaded SQLSRV40 from Microsoft website. When I try to install it is asking for

When I install, I have to enter a path to extract files and as it mentions in the website under installation instructions No.3 "When prompted, enter the path to the PHP extensions directory".

I have xampp and there is a php file directory. For my extracting path should I just give 'C:/xampp/php'?

I am a bit confused because, the under the comment section in the answer, @Crontab mentioned "My guess would be wherever you find all the other php_*.dll files". This means all the php_*.dll files should be under php folder right?

Also, say, if I extract them into that folder or different folder, when I added php_pdo_sqlsrv_7_nts_x64 into my php.ini folder and connected via apache I could not find my pdo_sqlsrv dll.

This is my first time installing SQL server drive. Any suggestion would be appreciated.

Upvotes: 1

Views: 706

Answers (1)

ficuscr
ficuscr

Reputation: 7054

Seeming like main issue was sqlsrv drivers available for download on Microsoft sites currently only support PHP 7.0.+, i.e. not PHP 7.1 or 7.2.

The solution is to either download newer drivers (https://github.com/Microsoft/msphpsql/releases support for 7.2 but labeled as "technical preview") or to downgrade to PHP version 7.0.

Other common gotchas are:

  • Failing to download the additional required Microsoft ODBC drivers.
  • Confusion over x86 and x64 versions of drivers (also ts/nts "thread safe" and "non thread safe"). Will depend on your system/php install.

Also seeing that pecl offers the 'preview' versions of the drivers: https://pecl.php.net/package/pdo_sqlsrv/5.0.0/windows

There they also offer up this useful description:

The Microsoft Drivers for PHP for SQL Server are PHP extensions that allow for the reading and writing of SQL Server data from within PHP scripts. The SQLSRV extension provides a procedural interface while the PDO_SQLSRV extension implements PDO for accessing data in all editions of SQL Server 2008 R2 and later (including Azure SQL DB). These drivers rely on the Microsoft ODBC Driver for SQL Server to handle the low-level communication with SQL Server.

Upvotes: 1

Related Questions