찾다
php教程php手册64位IIS7下的PHP 5.4配置及如何连接SQL Server 2008

64位IIS7下的PHP 5.4配置及如何连接SQL Server 2008

Jun 06, 2016 am 09:53 AM
64비트암호오픈 소스프로그램 작성프로그래밍 언어소프트웨어 개발연결하다구성

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

  1. 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
  2. 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
  3. 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是个不错的东西,推荐一下。

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

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

AI Clothes Remover

AI Clothes Remover

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

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

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

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

Atom Editor Mac 버전 다운로드

Atom Editor Mac 버전 다운로드

가장 인기 있는 오픈 소스 편집기

맨티스BT

맨티스BT

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

ZendStudio 13.5.1 맥

ZendStudio 13.5.1 맥

강력한 PHP 통합 개발 환경

에디트플러스 중국어 크랙 버전

에디트플러스 중국어 크랙 버전

작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

SecList

SecList

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