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

简介: 原文 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.

原文 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:

目录
相关文章
简单练习Microsoft SQL Server MERGE同步两个表
【10月更文挑战第13天】本文介绍了在Microsoft SQL Server中使用`MERGE`语句同步两个表的步骤。首先创建源表`SourceTable`和目标表`TargetTable`并分别插入数据,然后通过`MERGE`语句根据ID匹配行,实现更新、插入和删除操作,最后验证同步结果。此方法可根据需求调整以适应不同场景。
594 1
|
SQL 数据库连接 Linux
数据库编程:在PHP环境下使用SQL Server的方法。
看看你吧,就像一个调皮的小丑鱼在一片广阔的数据库海洋中游弋,一路上吞下大小数据如同海中的珍珠。不管有多少难关,只要记住这个流程,剩下的就只是探索未知的乐趣,沉浸在这个充满挑战的数据库海洋中。
503 16
|
数据库连接 PHP 数据库
【YashanDB知识库】PHP使用ODBC驱动无法获取长度为256char以上的数据
【YashanDB知识库】PHP使用ODBC驱动无法获取长度为256char以上的数据
|
SQL 开发框架 .NET
【YashanDB知识库】使用c-调用yashandb odbc驱动执行SQL时报YAS-08008 not all variables bounded
本文来自YashanDB官网,讨论了某客户在使用C# ASP.NET应用时遇到的异常问题。问题表现为YashanDB ODBC驱动不支持.NET框架通过绑定变量执行SQL语句,导致应用无法正常运行。该问题影响所有YashanDB版本及其ODBC驱动版本。解决方法包括避免使用绑定变量或升级ODBC驱动版本。文章通过示例代码展示了问题复现过程,并总结了最小化问题场景以定位和解决问题的经验。
|
SQL 开发框架 .NET
【YashanDB 知识库】使用 c- 调用 yashandb odbc 驱动执行 SQL 时报 YAS-08008 not all variables bounded
某客户C# ASP.NET应用在使用yashandb ODBC驱动时,因驱动不支持绑定变量执行SQL语句而报错“YAS-08008 not all variables bounded”,导致应用无法正常运行。影响所有yashandb及ODBC驱动版本。解决方法为避免使用绑定变量或升级驱动版本。通过简化场景成功复现问题。
|
SQL 安全 PHP
PHP开发中防止SQL注入的方法,包括使用参数化查询、对用户输入进行过滤和验证、使用安全的框架和库等,旨在帮助开发者有效应对SQL注入这一常见安全威胁,保障应用安全
本文深入探讨了PHP开发中防止SQL注入的方法,包括使用参数化查询、对用户输入进行过滤和验证、使用安全的框架和库等,旨在帮助开发者有效应对SQL注入这一常见安全威胁,保障应用安全。
966 4
|
SQL PHP 数据库
20 PHP如何捕获sql错误
路老师带你深入学习PHP,掌握技术干货。本文介绍了PDO中捕获SQL错误的三种模式:默认模式、警告模式和异常模式,以及如何使用errorCode()和errorInfo()方法进行错误处理。
|
关系型数据库 MySQL 网络安全
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
|
SQL 存储 监控
SQL Server的并行实施如何优化?
【7月更文挑战第23天】SQL Server的并行实施如何优化?
929 13
|
SQL 数据库
Microsoft SQL Server 2014如何来备份数据库
Microsoft SQL Server 2014如何来备份数据库
1819 3