操作系统: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: