久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

IIS 上的 MSSQL 和 PHP 5.3.5 之間的連接不起作用

Connection between MSSQL and PHP 5.3.5 on IIS is not working(IIS 上的 MSSQL 和 PHP 5.3.5 之間的連接不起作用)
本文介紹了IIS 上的 MSSQL 和 PHP 5.3.5 之間的連接不起作用的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我最近安裝了 IIS、PHP 5.3.5 和 MySQL,并且一切正常.

然后我也需要使用 MS SQL,我原以為很容易的任務(wù)現(xiàn)在讓我發(fā)瘋了,我不知道如何讓它工作.

根據(jù) php_info() 沒(méi)有加載 MS SQL 驅(qū)動(dòng)程序.

我下載了 php_mssql.dll 并在 php.ini 中啟用了它,但它不起作用.我發(fā)現(xiàn)新版本的 PHP 使用了不同的 dll.所以我下載了新的,把它放在 ext 文件夾中,并更新了 php.ini,但仍然沒(méi)有運(yùn)氣.

php_info() 仍未顯示驅(qū)動(dòng)程序已加載.

我將要卸載 IIS 和 PHP,然后安裝我之前安裝過(guò)的 Apache.

這個(gè)問(wèn)題是我最后一次嘗試,有人可以幫忙嗎?

解決方案

這是我不久前寫(xiě)的客戶常見(jiàn)問(wèn)題解答的片段,以幫助我們的專用托管客戶使用 MS SQL 驅(qū)動(dòng)程序啟動(dòng)和運(yùn)行 PHP.它可能會(huì)復(fù)制上面評(píng)論中已經(jīng)傳授的一些知識(shí),但它的完整性也可以幫助其他人從頭開(kāi)始:

注意:很明顯,自從我寫(xiě)這篇文章以來(lái),PHP 版本號(hào)已經(jīng)發(fā)生了一些變化,但一般原則仍然適用.

<小時(shí)>

安裝先決條件:Microsoft Drivers for PHP for SQL Server 需要 SQL Native Client:

<塊引用>

Microsoft SQL Server 2008 R2 Native Client X64 - 適用于 64 位 Windows

Microsoft SQL Server 2008 R2 Native Client X32 - 適用于 32 位 Windows

下載并安裝與您的系統(tǒng)匹配的 Native Client 驅(qū)動(dòng)程序.

PHP MS SQL 驅(qū)動(dòng)程序:

為 SQL Server 下載適用于 PHP 的 Microsoft 驅(qū)動(dòng)程序:

<塊引用>

微軟驅(qū)動(dòng)程序用于 SQL Server 的 PHP

該文件是一個(gè)自解壓可執(zhí)行文件,因此只需使用 7zip 或 WinRAR 并將文件解壓到您選擇的文件夾中.我們現(xiàn)在需要決定選擇與您的 PHP 安裝相匹配的驅(qū)動(dòng)程序.

PHP 5.3.5 有四種不同的版本:

  • PHP 5.3.5 非線程安全 VC9
  • PHP 5.3.5 非線程安全 VC6
  • PHP 5.3.5 線程安全 VC9
  • PHP 5.3.5 線程安全 VC6

要知道您安裝的是哪個(gè)版本,請(qǐng)打開(kāi) snapshot.txt 文件,該文件與 php.exephp-cgi.exe 等.不要使用 notepad.exe,因?yàn)樵撐募陂_(kāi)頭僅使用換行符 ( ) 作為行尾(unix 格式),而記事本會(huì)將它們合并為一行.

在文件中,您將看到一行(在第 6 行附近,或者在您使用記事本的第 1 行中間附近)以:Build::

開(kāi)頭<前>構(gòu)建:D:php-sdksnap_5_3vc9x86objRelease - 非線程安全,VC9 構(gòu)建構(gòu)建:D:php-sdksnap_5_3vc6x86objRelease - 非線程安全,VC6 構(gòu)建構(gòu)建:D:php-sdksnap_5_3vc9x86objRelease_TS - 線程安全,VC9 構(gòu)建構(gòu)建:D:php-sdksnap_5_3vc6x86objRelease_TS - 線程安全,VC6 構(gòu)建

這會(huì)告訴我們您正在運(yùn)行的 PHP 版本.

從您提取 MS SQL PHP 驅(qū)動(dòng)程序的文件夾中,選擇與正在使用的 PHP 版本匹配的驅(qū)動(dòng)程序(如果您不使用 PDO,則無(wú)需復(fù)制 php_pdo_ 驅(qū)動(dòng)程序):

<前>PHP 5.3.5 非線程安全 VC9:php_sqlsrv_53_nts_vc9.dll、php_pdo_sqlsrv_53_nts_vc9.dllPHP 5.3.5 非線程安全 VC6:php_sqlsrv_53_nts_vc6.dll、php_pdo_sqlsrv_53_nts_vc6.dllPHP 5.3.5 線程安全 VC9:php_sqlsrv_53_ts_vc9.dll、php_pdo_sqlsrv_53_ts_vc9.dllPHP 5.3.5 線程安全 VC6:php_sqlsrv_53_ts_vc6.dll、php_pdo_sqlsrv_53_ts_vc6.dll

假設(shè)您的 PHP 安裝位于 C:PHP,請(qǐng)將這些文件復(fù)制(不要移動(dòng))到您的 C:PHPEXT 文件夾.

打開(kāi)C:PHPPHP.INI并找到文件的Dynamic Extensions部分并添加:

<前>擴(kuò)展名=php_sqlsrv_53_nts_vc9.dll擴(kuò)展名=php_pdo_sqlsrv_53_nts_vc9.dll <-- 可選

最后,為了確保 PHP 可以找到這些擴(kuò)展,請(qǐng)確保 C:PHPPHP.INI 中的 extension_dir 指令設(shè)置為 C:PHPEXT:

<前>extension_dir = C:PHPext

重新啟動(dòng) IIS 并調(diào)用 phpinfo().如果一切順利,您應(yīng)該會(huì)看到:

如果您還加載了 PDO 驅(qū)動(dòng)程序,您應(yīng)該看到:

I recently installed IIS, PHP 5.3.5 and MySQL, and had it all working.

I then has a requirement for MS SQL as well, and what I thought would be an easy task, is now driving me crazy and I can't figure out how to make it work.

According to php_info() the MS SQL drivers aren't loading.

I downloaded php_mssql.dll and enabled it in php.ini but it didn't work. I found out that the new version of PHP uses a different dll. So I downloaded the new one, put that in the ext folder, and updated the php.ini, but still no luck.

php_info() still isn't showing the drivers are loaded.

I am about to uninstall IIS and PHP, and install Apache, which I've installed before.

This question is my last attempt, can anyone help?

解決方案

This is a snippet from a customer FAQ I wrote up a wee while ago to help our dedicated hosting customers get PHP up and running with the MS SQL Drivers. It may duplicate some knowledge already imparted in the comments above, but it's completeness may also help others starting from scratch:

Note: Clearly the PHP version numbers have moved on a bit since I wrote this but the general principles still apply.


Installation Pre-requisite: The SQL Native Client is required for the Microsoft Drivers for PHP for SQL Server:

Microsoft SQL Server 2008 R2 Native Client X64 - for 64 bit Windows
or
Microsoft SQL Server 2008 R2 Native Client X32 - for 32 bit Windows

Download and install the Native Client driver that matches your system.

PHP MS SQL Drivers:

Download the Microsoft Drivers for PHP for SQL Server:

Microsoft Drivers for PHP for SQL Server

The file is a self-extracting executable so just use 7zip or WinRAR and extract the files to a folder of your choice. We now need to decide which driver to choose that matches your PHP installation.

PHP 5.3.5 comes in four different flavours:

  • PHP 5.3.5 Non-threadsafe VC9
  • PHP 5.3.5 Non-threadsafe VC6
  • PHP 5.3.5 Threadsafe VC9
  • PHP 5.3.5 Threadsafe VC6

To tell which version you have installed open the snapshot.txt file which lives in the same folder as php.exe, php-cgi.exe etc. Don't use notepad.exe because the file uses just line feed ( ) for line ends (unix format) at the start and notepad mangles these into a single line.

In the file you will see a line (around line 6, or near the middle of line 1 of you did use notepad) starting with: Build::

Build: D:php-sdksnap_5_3vc9x86objRelease - non-threadsafe, VC9 build
Build: D:php-sdksnap_5_3vc6x86objRelease - non-threadsafe, VC6 build
Build: D:php-sdksnap_5_3vc9x86objRelease_TS - threadsafe, VC9 build
Build: D:php-sdksnap_5_3vc6x86objRelease_TS - threadsafe, VC6 build

This tells us what version of PHP you're running.

From the folder you extracted the MS SQL PHP drivers, choose the driver(s) that matches the version of PHP being used (if you're not using PDO then you don't need to copy the php_pdo_ drivers):

PHP 5.3.5 Non-threadsafe VC9: php_sqlsrv_53_nts_vc9.dll, php_pdo_sqlsrv_53_nts_vc9.dll
PHP 5.3.5 Non-threadsafe VC6: php_sqlsrv_53_nts_vc6.dll, php_pdo_sqlsrv_53_nts_vc6.dll
PHP 5.3.5 Threadsafe VC9: php_sqlsrv_53_ts_vc9.dll, php_pdo_sqlsrv_53_ts_vc9.dll
PHP 5.3.5 Threadsafe VC6: php_sqlsrv_53_ts_vc6.dll, php_pdo_sqlsrv_53_ts_vc6.dll

Assuming your PHP installation lives in C:PHP, copy (DON'T MOVE) these files to your C:PHPEXT folder.

Open C:PHPPHP.INI and locate the Dynamic Extensions part of the file and add:

extension=php_sqlsrv_53_nts_vc9.dll
extension=php_pdo_sqlsrv_53_nts_vc9.dll   <-- optional

Finally, to be sure that PHP can find these extensions, ensure the extension_dir directive in C:PHPPHP.INI is set to C:PHPEXT:

extension_dir = C:PHPext

Restart IIS and call phpinfo(). If all is well you should see:

And if you also loaded the PDO driver you should see:

這篇關(guān)于IIS 上的 MSSQL 和 PHP 5.3.5 之間的連接不起作用的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個(gè)表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動(dòng)填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 二区精品 | 国产欧美一区二区三区久久手机版 | 亚洲国产片| 国产91丝袜在线播放 | 一区二区三区四区日韩 | 欧美成人一区二区三区 | 国产高清免费 | 91一区| 日韩欧美在线不卡 | 色又黄又爽网站www久久 | 在线国产一区二区三区 | 黄色一级免费 | 欧美一级黑人aaaaaaa做受 | 黄色免费观看网站 | 欧美高清一区 | 两性午夜视频 | 亚洲精品国产综合区久久久久久久 | 亚洲在线一区 | 三级视频久久 | 亚洲精品欧美一区二区三区 | 久久精品免费看 | 亚洲一区二区三区在线 | 我我色综合 | 最新免费黄色网址 | 亚洲国产精品久久 | 极品国产视频 | 欧美白人做受xxxx视频 | 久久国产精品-国产精品 | 在线a视频网站 | 亚洲视频www | 美女在线观看国产 | 涩涩视频在线观看免费 | 精品国产一区二区三区在线观看 | 亚洲免费精品 | 在线观看国产 | h视频免费在线观看 | 国产精品一区二区在线 | 欧美精品三区 | 国产精品久久久久久久久久免费看 | 欧美日韩精品在线免费观看 | 久久国产香蕉 |