64位IIS7下的PHP 5.4配置及如何连接SQL Server 2008
操作系统: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是个不错的东西,推荐一下。

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

맨티스BT
Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

에디트플러스 중국어 크랙 버전
작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

SecList
SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.
