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

本文涉及的产品
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
云数据库 RDS SQL Server,基础系列 2核4GB
简介: 原文 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:

相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情: https://www.aliyun.com/product/rds/sqlserver
目录
相关文章
|
3月前
|
SQL
简单练习Microsoft SQL Server MERGE同步两个表
【10月更文挑战第13天】本文介绍了在Microsoft SQL Server中使用`MERGE`语句同步两个表的步骤。首先创建源表`SourceTable`和目标表`TargetTable`并分别插入数据,然后通过`MERGE`语句根据ID匹配行,实现更新、插入和删除操作,最后验证同步结果。此方法可根据需求调整以适应不同场景。
160 1
|
2月前
|
SQL 安全 PHP
PHP开发中防止SQL注入的方法,包括使用参数化查询、对用户输入进行过滤和验证、使用安全的框架和库等,旨在帮助开发者有效应对SQL注入这一常见安全威胁,保障应用安全
本文深入探讨了PHP开发中防止SQL注入的方法,包括使用参数化查询、对用户输入进行过滤和验证、使用安全的框架和库等,旨在帮助开发者有效应对SQL注入这一常见安全威胁,保障应用安全。
68 4
|
3月前
|
SQL 数据库
执行 Transact-SQL 语句或批处理时发生了异常。 (Microsoft.SqlServer.ConnectionInfo)之解决方案
执行 Transact-SQL 语句或批处理时发生了异常。 (Microsoft.SqlServer.ConnectionInfo)之解决方案
487 0
|
4月前
|
关系型数据库 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)")
|
5月前
|
SQL 数据库
Microsoft SQL Server 2014如何来备份数据库
Microsoft SQL Server 2014如何来备份数据库
511 3
|
5月前
|
SQL 运维 监控
SQL Server 运维常用sql语句(二)
SQL Server 运维常用sql语句(二)
46 3
|
5月前
|
SQL XML 运维
SQL Server 运维常用sql语句(三)
SQL Server 运维常用sql语句(三)
40 1
|
5月前
|
SQL 关系型数据库 MySQL
SQL数据库和 SQLserver数据库
【8月更文挑战第19天】SQL数据库和 SQLserver数据库
73 2
|
5月前
|
Java 应用服务中间件 Maven
从零到英雄:一步步构建你的首个 JSF 应用程序,揭开 JavaServer Faces 的神秘面纱
【8月更文挑战第31天】JavaServer Faces (JSF) 是一种强大的 Java EE 标准,用于构建企业级 Web 应用。它提供了丰富的组件库和声明式页面描述语言 Facelets,便于开发者快速开发功能完善且易于维护的 Web 应用。本文将指导你从零开始构建一个简单的 JSF 应用,包括环境搭建、依赖配置、Managed Bean 编写及 Facelets 页面设计。
111 0
|
5月前
|
SQL 关系型数据库 MySQL
【超全整理】SQL日期与时间函数大汇总会:MySQL与SQL Server双轨对比教学,助你轻松搞定时间数据处理难题!
【8月更文挑战第31天】本文介绍了在不同SQL数据库系统(如MySQL、SQL Server、Oracle)中常用的日期与时间函数,包括DATE、NOW()、EXTRACT()、DATE_ADD()、TIMESTAMPDIFF()及日期格式化等,并提供了具体示例。通过对比这些函数在各系统中的使用方法,帮助开发者更高效地处理日期时间数据,满足多种应用场景需求。
602 0