Unofficial Microsoft SQL Server Driver for P

系统 1801 0

原文 Unofficial Microsoft SQL Server Driver for PHP (sqlsrv)

Here are unofficial modified builds of Microsoft's sqlsrv and pdo_sqlsrv drivers for PHP, version 3.0, for:

  • PHP 5.6 for Windows Vista/2008 and above (32 and 64 bit) 
  • PHP 5.5 for Windows Vista/2008 and above (32 and 64 bit) 
  • PHP 5.3 and 5.4 for Windows XP/2003 and above (32 bit)
    Microsoft's version 3.0 driver does not run on XP/2003 because it has a hard-coded dependency on the SQL Server 2012 Native Client (ODBC driver), which will not install on XP.  To fix the problem I just had to allow the PHP driver to use an older version of the ODBC driver supported by XP.



Downloads


The latest drivers are exactly the same as Microsoft's, except:

  1. All known memory leak and memory exception bugs have been fixed *
  2. Column names can contain unicode characters
  3. The newest of any of these ODBC drivers is selected, depending on what's installed:
    1. SQL Server Native Client 12.0  (hasn't been invented as of June 2014!)
    2. SQL Server Native Client 11.0  (SQL Server 2012 ODBC driver)
    3. SQL Server Native Client 10.0  (SQL Server 2008/r2 ODBC driver)
    4. SQL Native Client  (SQL Server 2005 ODBC driver)
  4. 64 bit versions included for PHP 5.5 and 5.6



Builds for PHP 5.3 and PHP 5.4 work on XP and above.

Builds for PHP 5.5+ only work on Windows Vista/2008 and above - PHP 5.5+ is built with the 2012 Visual C++ 11 compiler and it generates code that works on Windows Vista and above.  I am comfortable with that - XP has been superseded a long time ago, Windows 8.1 is absolutely great, and don't forget that upgrading Windows also upgrades to a far better web server in IIS 7.5 or 8.5.


It's never a good idea to look at the source code of things you like - since I had to look, my new list of things to do includes writing a new version of this driver.  It is a wrapper around the ODBC API, and has no business making strict dependencies on any version of the SQL Server Native Client.  It should even work with SQL Server 6, because there is an ODBC driver for that too.  Furthermore, it's a pretty ugly bit of code and every update is likely to introduce new bugs.  It's still a better choice than using the PHP ODBC driver, as it's much faster in returning data, it is multilingual (nchar and nvarchar), it supports the majority of data types, and includes parameters.


* Sqlsrv changes
The sqlsrv driver has a fix to a bug found by Charles Durrant ( http://sqlsrvphp.codeplex.com/workitem/22427 ) which I too recently experienced when running PHP-32 on a 64 bit server.  I noted Charles's post when he first reported the bug, but tried my best to avoid working on the source code until I had to... Charles saved me a huge amount of time, so thank you to him.  My fix is different, I have repaired all of Microsoft's dodgy auto pointers and completely rewritten the horrible function that caused the crash.  If anyone uses these new builds and spots memory leaks or bugs due to these changes, please let me know and I'll fix them within a day or two.

Microsoft's official downloads are here:


SQL Server Native Clients are here:

Unofficial Microsoft SQL Server Driver for PHP (sqlsrv)非官方的PHP SQL Server 驱动


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论