PHP 5.5 and MSSQL driver: Installing ODBC Driver 11 in Windows Server 2012 R2

Hikari picture Hikari · Jan 26, 2015 · Viewed 10.6k times · Source

I have a Windows Server 2012 R2 with IIS 8.5, and another server with MSSQL 2012. I must install PHP in IIS and connect to MSSQL, and I don't have Internet available for Web PI.

I managed to install PHP 5.5 and I'm able to run phpinfo(), and I also assured that php.ini is being loaded from C:\php\php.ini.

I was also able to load sqlsrv driver, it reports in example sqlsrv.ClientBufferMaxKBSize 10240 10240.

But when I execute a php file that connects to DB, I get a message

This extension requires the ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712

I went to that site and it says

Supported operating systems for version 3.1 of the driver include Windows Server 2012 R2`.

It says

Version 3.1 requires Microsoft ODBC Driver 11 (or higher) for SQL Serverand points tohttp://www.microsoft.com/en-us/download/details.aspx?id=36434`.

In that page, in System Requirements, WinServer 2012 R2 is not listed. When I try to install msodbcsql.msi I get message

Installation of this product failed because it is not supported on this operation system. For information on supported configurations, see the product documentation.`

Well I'm now stuck. I need PHP in WinServer 2012 R2 and IIS 8.5 connecting to MSSQL 2012. But its driver requires ODBC 11, which seems to not support latest WinServer.

Is there any hope, or will I need to wait for Microsoft to support its own OS in its own drivers?

Answer

Sean Decker picture Sean Decker · Feb 2, 2015

Be sure to download the 1033\x64\msodbcsql.msi (4.4 MB) installer. Even though you are using PHP x86, you need the x64 installer since the OS is x64. I had the same issue and my app now works with PHP x86 after installing the x64 installer.