64位IIS7下的PHP 5.4配置及如何连接SQL Server 2008
来源:互联网 发布:js 字段默认值 编辑:程序博客网 时间:2024/06/16 20:11
操作系统:Windows Server 2008 R2 SP1(x64)
数据库:SQL Server 2008 R2 SP1(x64)
PHP:5.4.x
先用手动安装,fastcgi模式,这个网上教程很多,很快就装完了。再安装Microsoft Drivers for PHP for SQL Server,但是用PDO连接SQL Server 2008数据库时,提示“could not find driver1”,意即mssql驱动没有加载成功。在网页上执行phpinfo显示所有参数查看,果然没有加载mssql驱动!
根据微软驱动自带的帮助文档仔细核对:
To load the Microsoft Drivers for PHP for SQL Server when PHP is started, first move a driver file into your extension directory. Then, follow these steps:
To enable the SQLSRV driver, modify php.ini by adding the following line to the extension section, or modifying the line that is already there (this example uses the version 3.0 thread safe driver for PHP 5.3):
extension=php_sqlsrv_53_ts.dll
To enable the PDO_SQLSRV driver, modify php.ini by adding the following line to the extension section, or modifying the line that is already there (this example uses the version 3.0 thread safe driver for PHP 5.3):
extension=php_pdo_sqlsrv_53_ts.dll
If you want to use the PDO_SQLSRV driver, the php_pdo.dll must be available, either as a built-in extension, or as a dynamically-loaded extension. If you need to load the PDO_SQLSRV driver dynamically, the php_pdo.dll must be present in the extension directory and the the following line needs to be in the php.ini:
extension=php_pdo.dll
Restart the Web server.
发现PHP的安装目录下根本没有php_pdo.dll文件,所以加载失败也不足为奇。
捣鼓了几个小时,最后没有办法,卸载PHP,通过Web Flatform Installer来安装PHP,在弹出的可选组件中,赫然有“Microsoft SQL Server 2012 Native Client”一项,不太明白为什么,我自己的机器上已经有2008 R2版的Native Client了呢,会不会多此一举徒劳无功呢?然而安装结束后,连IIS都不用重启,就可以连上数据库了,震精,哥彻底无语!
看来最新的php已经修改了SQL Server驱动加载的模式,不再需要php_pdo.dll了,却需要一个最新的Native Client,可惜微软的文档上没有说明,让我抓瞎了好久。
另外,Web Flatform Installer是个不错的东西,推荐一下。
- 64位IIS7下的PHP 5.4配置及如何连接SQL Server 2008
- 64位Win2008 Server下IIS7+ASP+Access站点配置
- php连接SQL Server数据库及相关的配置
- Windows 2008服务器环境PHP连接SQL Server数据库的配置及连接方法
- sql server 2008 r2 64位 如何连接oracle
- Win8.1OS64位oracle11安装配置及PL/SQL Developer如何连接64位oracle
- PHP配置连接SQL Server
- IIS7下的Web应用程序以“Windows集成安全性”方式连接到远程SQL Server
- 基于 MySQL 和 SQL SERVER 下的 Tomcat 数据连接池的配置及应用示范
- win7 64位,在ODBC的DNS中对sql server配置成功,但连接失败
- Win7(32位) 安装IIS7及ASP的配置
- jdk 1.8 配置与sql server 2008 连接 ( win10 64位)
- 转载-64位SQL Server 2008的Linked Server连接64位的Oracle--Oracle Provider for OLEDB
- PHP连接sql server 2005环境配置
- Vista/Win7/Win2008下配置ASP+Access(解决asp 500错误)及Win2008等64位IIS7运行asp+access的方法
- Windows 2008Server R2 IIS7 服务器中隐藏index.php的配置
- php 连接 SQL Server 2008
- php连接sql server 2008
- android View.INVISIBLE与View.GONE的差别
- JS编程必备
- mysql中如何快速查找某个字段所在的表
- Google Protocol Buffers 入门
- CSS清除浮动的4种方法
- 64位IIS7下的PHP 5.4配置及如何连接SQL Server 2008
- 使用jQuery模拟鼠标点击a标签事件
- poj2456 二分搜索
- 插入数据库中文乱码的方法
- 单例模式
- 回答为什么会叫“Bulk Gas”
- 【poj 1743】后缀数组
- Windows开机自启动程序的方法
- Protocol Buffers 语法指南