1、到微软官方去下载新的驱动,下载地址如下:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9
官方文档有描述:
Refer to the documentation that is installed with the driver for a description of the new features in this release. The SQL Server Driver for PHP download is available to all SQL Server users at no additional charge. The SQL Server Driver for PHP is a PHP 5 extension that allows for the reading and writing of SQL Server data from within PHP scripts. The extension provides a procedural interface for accessing data in all editions of SQL Server 2005 and SQL Server 2008.
根据官方文档的描述,微软提供的Driver是同时提供给SQL Server 2005和SQL Server 2008两个版本使用的。
下载驱动(上边有链接地址)下载过后的驱动包里面的内容如下图:
<!--StartFragment -->
2、需要修改C:/WINDOWS/php.ini中的配置:
查找;extension_dir 修改为extension_dir="E:/Program Files/php-5.3.1/ext"这里的目录是安装的PHP目录,ext里是PHP的一些扩展文件,运行时需要加载其中的一些,现在连接sqlserver,所以一定要去掉extension_dir 前面的分号;
3、把上图解压开的需要的dll文件拷贝到extension_dir设置的扩展目录里面。
其中‘53’表示php的版本,‘ts’表示启动线程安全,‘nts’表示未启动线程安全,vc6为apache配置,vc9为iis配置
4、修改php.ini实现扩展:
在php.ini的一大堆;extension=**.dll格式里面添加行,此部分位于以下注释下边一般:
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
添加拷贝的dll文件,例:
extension=php_sqlsrv_53_ts_v9.dll
注意=号右边是解开过后的扩展的两个驱动的文件名,必须保证此文件在配置好的扩展目录内,而且需要注意此处最初不需要带“;”。【*:在php.ini文件里面,首部分号的含义代表行注释,如果有分号的时候,服务器在读取配置的时候会略过分号这一行不去读取相关内容,只有没有加分号的行才会被服务器读取。】
这里解释一下,两个驱动程序的区别在于,php_sqlsrv_ts.dll是线程安全的驱动,如果服务器本身的环境是使用的php5ts.dll,就是用这个驱动;php_sqlsrv_nts.dll不是线程 安全的,这种情况下,服务器运行PHP应该加载的是php5.dll
5、测试配置环境:
整个过程操作好了过后,写一个test.php测试一下配置的相关环境,测试代码如下:
<?php
phpinfo();
?>
若出现以下图片证明环境已经配置好了:
这里列举一下开发环境,以防出现不同环境有差异的地方:
OS:Windows Server 2008 x64 Enterprise Edition
WebServer:Apache 2.2.11
Database:SQL Server 2008 x64 Enterprise Edition
PHP:5.2.9
(*:在配置PHP环境的时候,如果是解压缩的版本,在Windows平台上需要拷贝PHP根目录下所有的DLL文件到Windows的目录里面,需要说明的是:Windows 32位系统的目标目录为:$:/Windows/System32,Windows 64位环境的目标目录为:$:/Windows/SysWOW64,这里$符号代表安装操作系统的盘符号。而且本文的Driver好像运行的最低PHP版本应该为5.2.6,官方文档里面说的测试版本是使用的PHP5.2.6,至于低版本是否可以运行,我没有测试。)
分享到:
相关推荐
Xampp1.7 链SQLServer2005/SQLServer2008,配置与测试; 扩展库 sqlserver driver for php
SQLSRV30 PHP连接sql server2008 SQL Server Driver for PHP3.0 PHP自带的php_mssql.dll文件已经满足不了sql server2005及其以上版本的使用了。微软也随之发布了SQL Server Driver for PHP来做相应的支持。 其中...
SQLSRV30 PHP连接sql server2008 SQL Server Driver for PHP3 0 PHP自带的php mssql dll文件已经满足不了sql server2005及其以上版本的使用了 微软也随之发布了SQL Server Driver for PHP来做相应的支持 其中SQL ...
php7.4版本适配SQL-server数据库的驱动,详细配置方式查看相应文档
含64位 php7.3的odbc驱动... sqlserver的PHP版本驱动安装,把下载到的.dll文件和.pdb拷贝到PHP目录下的ext子目录。 5、在phpstudy中开启相对应的3个扩展(有可能要重启Apache才会出现) Pdo_odbc Pdo_sqlsrv sqlsrv
SQLSRV30 PHP连接sql server2008 SQL Server Driver for PHP3.0 PHP自带的php_mssql.dll文件已经满足不了sql server2005及其以上版本的使用了。微软也随之发布了SQL Server Driver for PHP来做相应的支持。 其中...
linux配置php5.6.23连接sqlserver,使用freetds php拓展使用mssql和dblib
php5.3以后不在支持mssql需要使用php_sqlsvr.dll来连接sqlServer,微软不支持64为驱动,资源中32位、64为的dll和驱动都有
SQLSRV20 Microsoft Drivers for PHP for SQL Server2.0 PHP自带的php_mssql.dll文件已经满足不了sql server2005及其以上版本的使用了。微软也随之发布了SQL Server Driver for PHP来做相应的支持。 其中SQL ...
之前连接了无数次,看了无数教程,说得非常非常复杂,但都都没连接成功,浪费... 说明:php_mssql.dll是PHP与SQL Server连接的函数库。ntwdblib.dll是连接SQL Server2005服务器的,上面两个文件版本必须与PHP版本相同。
PHP的PDO连接SQLSERVER: 含全套工具: php5.4_x86_nts安装包 微软的SQLSRV拓展 微软的odbc驱动msodbcsql.msi 微软的sql客户端sqlncli.msi 配置好的php.ini 具体安装说明(原创亲测) 说实话这个得来很不容易,整整一天...
最近研究PHP, 发现在THINKPHP不错, 但是想用THINKPHP连接SQLSERVER数据库,才到这个文件,希望对大家有用
php(laravel+apache+SQLserver)配置链接SQLserver所需文件
PHP+SQLServer2005+系统DSN配置+ODBC查插删改.pdf
php连接sqlsever数据库配置方法,本人在winserver2008 r2系统中,使用wamp平台搭建php(PHP 版本5.6)环境,正常连接上远程服务器的sqlserver 2008数据库。
软件及系统版本: Windows xp sp3 Iis5.1 Apache 2.2 Php 5.2 Sqlserver 2005
PHP链接SQL Server数据库的扩展文件,这是64位的,放在PHP配置文件中即可,按需下载~~
32位 PHP5.6 已经配置好mencache和sql server 拿去复制本机直接使用
本文实例讲述了PHP7使用ODBC连接SQL Server2008 R2数据库。分享给大家供大家参考,具体如下: 我用的是:WampServer集成工具,PHP版本为7.0.29,数据库为SQL Server 2008 R2; 注意:在连接数据库时,需要进入X:\...
Forbidden You don't have permission to access / on this server.