具有 (PDO) MS-SQL 支持的 IIS7 上的 PHP [英] PHP on IIS7 with (PDO) MS-SQL support

查看:35
本文介绍了具有 (PDO) MS-SQL 支持的 IIS7 上的 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个 IIS 7 Windows 服务器,我的 phpinfo 的配置命令的相关部分目前报告了这个:

<块引用>

cscript/nologo configure.js ...... "--without-mssql""--without-pdo-mssql" "--without-pi3web" ...... "--with-mcrypt=static"

我需要对我的服务器做什么才能看到上面的 with-mssql 而不是看到 without-mssql?

曾经有人告诉我要重新编译 PHP.这就是降压停止的地方.因为这个 PHP 附带了 IIS 安装,所以我们以前不需要编译 PHP.重新编译……这是命令行的事吗?

解决方案

Microsoft SQL Server 支持和扩展不再随 PHP 一起提供.要将 PHP 与 SQL Server 连接,您需要 Microsoft Drivers for PHP for SQL Server:p><块引用>

Microsoft Drivers for PHP for SQL Server 是一个 PHP 5 扩展,它提供对 SQL Server 2005 及更高版本的数据访问,包括SQL Azure.

驱动程序的下载页面列出了四个可供选择的版本.请参阅 系统要求 页面以确定您需要的版本.您必须为您的操作系统+SQL Server+PHP 版本组合安装正确的驱动程序.

根据您选择的驱动程序,您还需要其中之一(这些必须单独安装):

  • SQL Server 本地客户端
  • 适用于 SQL Server 的 Microsoft ODBC 驱动程序 11

安装程序只需提取指定位置的文件.您必须将文件放到 PHP 扩展目录中.这些文件是 PHP 扩展.文件名表示:

  • nts/ts -- 应该与 PHP 的非线程安全/线程安全版本一起使用
  • 54/55/56... -- 应与 PHP 版本 5.4、5.5、5.6...
  • 一起使用
  • sqlsrv/pdo_sqlsrv -- 提供过程接口/PDO接口

启用 php.ini 文件中的扩展,确保线程安全性和 PHP 版本匹配.

检查 phpinfo 以查看是否加载了扩展.测试 sqlsrv_connect("servername")new PDO("sqlsrv:server=servername") 以确保扩展正常工作.

I'm running an IIS 7 windows server and a relevant part of my phpinfo's configure command currently reports this:

cscript /nologo configure.js ...... "--without-mssql" "--without-pdo-mssql" "--without-pi3web" ...... "--with-mcrypt=static"

What do I need to do to my server so that I can see the with-mssql above as opposed to seeing without-mssql?

I was once told to recompile PHP. That's where the buck stopped. Cause this PHP came with IIS install so we never needed to compile PHP before. Re-compiling... is that a command line thing?

解决方案

Microsoft SQL Server support and extensions are not shipped with PHP anymore. To connect PHP with SQL Server you need Microsoft Drivers for PHP for SQL Server:

The Microsoft Drivers for PHP for SQL Server is a PHP 5 extension that provides data access to SQL Server 2005 and later versions including SQL Azure.

The download page for drivers lists four versions to choose from. Consult the System Requirements page in order to determine which version you need. You must install the correct driver for your Operating System+SQL Server+PHP version combination.

You will also need one of these depending on which driver you choose (these must be installed separately):

  • SQL Server Native Client
  • Microsoft ODBC Driver 11 for SQL Server

The installer simply extracts the files in the specified location. You must the files to PHP extensions directory. The files are PHP extensions. The file names indicate:

  • nts/ts -- should be used with non thread safe/thread safe version of PHP
  • 54/55/56... -- should be used with PHP version 5.4, 5.5, 5.6, ...
  • sqlsrv/pdo_sqlsrv -- provides procedural interface/PDO interface

Enable the extensions in php.ini file making sure that thread safetyness and PHP versions match.

Check phpinfo to see if extensions are loaded. Test sqlsrv_connect("servername") and new PDO("sqlsrv:server=servername") to make sure the extensions are working.

这篇关于具有 (PDO) MS-SQL 支持的 IIS7 上的 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆