0
votes

I am attempting to access a mssql 2005 database using Microsoft's supplied sqlsrv drivers. I have tried every driver version from 3.1 to 2.0, installing a different version of XAMPP with different versions of PHP installed.

  • version 3.1 = php version 5.4.7 error:

This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86

  • version 3.0 = php version 5.3.1 error:

This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server. Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86:

  • version 2.0 = php version 5.2.1 and 5.2.4

Php drivers are unrecognized and do not appear in phpinfo().

I am under the impression the extension should support ALL EDITIONS of SQL Server 2005 and greater...

I installed both the SQL Server 2012 Native Client and the SQL Server 2008 Native Client (SP3). According to this article I can test the ODBC connectivity to a SQL Server.

Entering odbcping at a command prompt returns:

'odbcping' is not recognized as an internal or external command....

I checked the ODBC Data Source Administrator and found the ODBC Driver 11 for SQL Server is listed in the drivers tab.

enter image description here

Any assistance as to what I may be missing?

1

1 Answers

2
votes

You are mixing up two things: ODBC and PHP drivers for MS SQL Server 2005.

  • If you install SQLDRV 3.X, you dont use ODBC.
  • If you use ODBC, then you may need different PHP driver than SQLDRV.

I also struggled few hours with setting up PHP connection to MS SQL Server 2003, 2005, 2008 with Studio Express. I used pdo_sqldrv driver installed via SQLDRV drivers provided by Microsoft. Installing PHP drivers was easy part. Once you see pdo_sqldrv in phpinfo(), you are done with PHP driver. Difficult is second part - setting up properly MSSQL environment to allow PHP for connection. I did following steps:

  • downloaded & installed free MSSQL Studio Express 2005 (or 2008, both work fine)
  • installed or upgraded to dotNetFx40Setup.exe
  • installed msxml6.msi (I think this was only needed for version 2005)
  • installed MSSQL Native Client
  • logged into studio and created new user for PHP only with read/write permissions
  • enabled pipe and other connection resources
  • figured out correct connection string "sqlsrv:server=PCHOME\\SQLEXPRESS;database=eshop"

Then it worked, but definitely it was not easy setup. G'd luck.