[教學] 使用微軟 MS SQL Server 2000 架設 phpBB2

phpBB-TW Knowledge Base
收集網友們在竹貓所發表的教學主題或文章,以利分享!
(僅供瀏覽,由版主群維護)
回覆文章
頭像
brentsu
星球公民
星球公民
文章: 232
註冊時間: 2004-08-23 09:08
來自: BNW 時尚資訊網
聯繫:

[教學] 使用微軟 MS SQL Server 2000 架設 phpBB2

文章 brentsu »

我真的快哭了~~~不知道該【喜極而泣】還是【欲哭無淚】....
從我註冊時間算到現在也有 1 年多了..... 想不到,在竹貓、phpBB 與各大討論區爬了很久,終於解決了這個問題!!
以前就算你把 php + phpBB + MS SQL 2000 通通裝在同一部電腦,phpBB 還是連不上 MS SQL 2000!
因此只能透過 ODBC 的 SQL Driver 連到 MS SQL 2000,多透過一層,資料處理速度當然更慢啦~~
竹貓爬很久,都是網友幫我解決問題,現在決定回饋一下!

廢話不多說,先看正確的架站步驟:

※要準備好的材料如下:
Windows Server 2000 / 2003 / WinXP Pro (使用 IIS5 / IIS6)
Microsoft SQL Server 2000 中文版
php 4.4 (5.0/5.1 也可以,但是不建議,4.4 版需要同時下載 .exe 版與 .zip 版)
phpBB 2.0.17 或更新的版本 (推薦我做好的 UTF 8 版)\r

請到 php.com 下載 php-4.4.0-Win32.zip 以及 php-4.4.0-installer.exe 備用。

※簡要的安裝步驟如下(也就是說你必須是架 phpBB 高高手):
1. 安裝好 Windows Server / WinXP 的 IIS,確定你的 html 能跑

2. 安裝好 MS SQL Server 2000,並新增一個專用的管理 phpBB 帳號,例如 root

3. 在 SQL Server 2000 新增一個資料庫,例如 phpbb,這樣會產生一個只有預設資料表的空白資料庫\r

4. 用【php-4.4.0-installer.exe】安裝好 php,使用預設值,通通按 Next 即可。這樣會幫你在 IIS 設好,也會把 php 安裝到 C:\PHP 裡面。不過這種裝法,C:\PHP 裡面可說是只有【陽春版】啥都沒有....

5. 解開【php-4.4.0-Win32.zip】檔案,然後把所有檔案通通 copy 到 C:\PHP 裡面,有相同的檔名就不要再覆蓋了!

6. 把【extensions】資料夾更名為【ext】(同 php 5)

7. 修改 C:\Windows 底下的【php.ini】檔,找到並修改成【extension_dir = "c:\php\ext"】

8. 刪除【extension=php_mssql.dll】前面的 ; 註解,讓這行指令生效。

9. 把 C:\PHP 的【php4ts.dll】拷貝到【C:\Windows\System32】裡面,並建議重新開機。

10. 寫一個 phpinfo.php 的小程式,來查 php 安裝資訊,看看各項設定是否正確,例如:

<? php phpinfo() ?>

請留意是否有【mssql】這個表格,請留意【Library version】是否為【7.0】?這表示你的 php_mssql.dll 有被載入並運作中!如果沒有,甚至出現找不到【c:\php\ext\php_mssql.dll】的錯誤訊息,就表示前面的安裝並沒有裝好。

圖檔

11. 就算 php 的 MS SQL 正確運作,phpBB 會因為連不到 MS SQL 仍然無法安裝,我終於在 php.com 找到以下的正確解答!!!

I am trying to connect to SQL Server 2000 from PHP
I bumped to following warning:
Warning: mssql_connect(): Unable to connect to server: SERVER\Portal
....... on line 5

on line 5 there is:
$db_connect = mssql_connect('SERVER\Portal', 'sa', 'my_passwd');

I did the following
1.enabled php_mssql.dll extension in PHP.ini
2.every dll is in proper place(System32 or PHP folder),including ntwdblib.dll

I search lots of profile throught web ,but no one give me proper answer to resolve it.

after a few hour ,I found the problem was caused by
ntwdblib.dll ,which version is 7.00.839 ,when I replaced old ntwdblib.dll with the new ntwdblib.dll ,which version is 8.00.194 ,all problem are solved.

We had some, read A LOT, of problems with MSSQL under Windows 2003.
We had 2 the same windows, php, php-ini, everything machines but only one could connect. Unable to connect was the error message.

Finnaly we checked the version of ntwdblib.dll and the one distributed with PHP was 7.00.... and the version of the one on the SQL Server install was 8.00.... so we copied this one in the php and apache dir and it worked.

12. 這一步是重要關鍵!上面的英文沒說出來的重點就是,你必須到 Microsoft SQL Server 2000 安裝的電腦上,把 C:\Windows\System32 裡面的【ntwdblib.dll】8.0 版,拷貝到架設 phpBB 的電腦裡面!並重新開機!!

因為 php 5.0 裡面附的【ntwdblib.dll】的 Client 程式根本是 MS SQL 7.0 版!!當然沒辦法與 MS SQL 2000 的 8.0 版溝通!而 php 4.4 根本不提供這個檔案.....

所以將 8.0 版的【ntwdblib.dll】檔案,從 SQL Server 電腦拷貝到 Web Server 電腦上就行了。如果是通通裝在一部電腦上,就不用 copy 了。不過如果你已經用 php 5 的 7.0 版蓋掉 8.0 版,就只好重裝 SQL Server 2000 了。

最後執行 http://localhost/phpbb2/ 之類的安裝動作,點選【MS SQL 7.0/2000】就可以用 MS SQL 來支援 phpBB 囉!!

因為我不斷爬文、錯誤測試,所以希望不要漏掉哪個重要步驟,如果架不起來,歡迎提出來討論。
※架設伺服器主機:Mac mini 1.5GHz, 1GB RAM x 三部
※架設主機作業系統:Mac OS X Server 10.6.6 Snow Leopard
※我的上網方式:固定制 ADSL 16M/8M、6 IP
※安裝的伺服器:Apache + php 5 + MySQL 5
※我的 phpBB2 版本:phpBB 3.0.x UTF-8 版
※BNW會議室網址: http://www.bnw.com.tw/conference/
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

[轉貼]修正建議

文章 心靈捕手 »

--以下為轉貼來自網友 617 的 PM--
已通知該文章作者,但是那是在教學文件庫,他說他權限不夠,只能PM版主修改
so 請幫個忙改一下,以利之後的新手使用

以下為與該作者PM的原文...

brentsu 寫到:
617 寫到:
原文:
http://phpbb-tw.net/phpbb/viewtopic.php?t=38030

之中有段
<? php phpinfo() ?>
這個語法錯誤(實際用php跑),

這個語法才正確
<?php phpinfo(); ?>

應該是
第3個字元不該是空格

PHPver:
PHP 4.4.2

感謝您發此文,我才得以順利架站


不客氣,大家教學相長,互相幫助求進步.... 哈哈...
你說得一點也沒錯,那段程式是我直接剪貼上來的,不過在教學精華區的文章連我自己也不能改 (僅供瀏覽,由版主群維護),大概只能寫 PM 請版主幫忙改,或是只好繼續錯下去了....
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
回覆文章

回到「教學文件庫」