php環境配置 php5 mysql5 apache2 phpmyadmin安裝與配置

NO IMAGE

php環境的配置,對於新手來說,絕對是一件煩事。總會遇到這樣那樣的問題,走很多彎路。
所以今天特意寫了這個配置文件,相信按照以下步驟你一定會成功的。錯誤的地方也希望各
位指正。
更多文章 php愛好者站 http://www.phpfans.net

本例是在wiondws下 apache2.0.55  php5.1.1(zip)  mysql5.0.19  phpmyadmin2.7.0安裝與配置
以上資源可以在本站下載站http://www.phpfans.net/download.php/下載

/*
作者:我不是魚
網址:http://www.phpfans.net
部落格:http://www.phpfans.net/space/index.php/2
email:[email protected]
*/

Apache 的安裝
1 點選apahce安裝包
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134330520.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134330520.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

2 下面3項隨便填
    apache 監聽80 埠。如果iis用了80埠,修改iis埠或者apache埠,以免衝突
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134333421.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134333421.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

3 這裡預設的是 typical。如果想修改安裝路徑的話也可以選擇custom,注意安裝路徑不能含中文
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134333562.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134333562.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

4 開始安裝
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134333178.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134333178.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

5 安裝完成後在瀏覽器裡打入  http://localhost
如果可以看到這個頁面,證明apache安裝成功,已經可以解釋靜態頁面了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134333802.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134333802.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

MySQL 的安裝

1 點選mysql安裝包
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134334711.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134334711.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

2 預設是Typical,如果想修改安裝路徑的話也可以選擇custom.
注意:安裝mysql的路徑中,不能含有中文!
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134334786.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134334786.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

3 安裝開始
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134334901.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134334901.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

4 跳過註冊
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134334493.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134334493.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

5 是否現在就配置 mysql。也可以之後在開始選單的configuration wizard 進行配置
  這裡是現在進行配置
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134335500.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134335500.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

6 選擇Detailed Configuration,點Next繼續
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134335170.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134335170.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

7 下面這個選項是選擇mysql應用於何種型別,第一種是開發伺服器,
將只用儘量少的記憶體,第二種是普通WEB伺服器,將使用中等數量記憶體,
最後一種是這臺伺服器上面只跑mysql資料庫,將佔用全部的記憶體。
使用者可根據自己的需求,選擇選項。這裡只選擇開發伺服器,點Next繼續
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134335825.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134335825.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

8 下面是選擇資料庫用途,第一種是多功能用途,
將把資料庫優化成很好的innodb(事務)儲存型別和高效率的myisam(非事務)儲存型別,
第二種是隻用於事務處理型別,最好的優化innodb,但同時也支援myisam,只有myisam才支援全文索引
最後一種是非事務處理型別,適合於簡單的應用,只有不支援事務的myisam型別是被支援的。
一般選擇第一種多功能的。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134335511.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134335511.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

9 下面是選擇InnodDB的資料存放位置,一般預設好了,不需要改動
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134336911.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134336911.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

10 下面是選擇mysql允許的最大連線數,第一種是最大20個連線併發數,
第二種是最大500個併發連線數,最後 一種是自定義,你可以根據自己的需要選擇。
這裡選擇第一個
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134336287.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134336287.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

11下面是選擇資料庫監聽的埠,一般預設是3306,如果改成其他埠,
以後連線資料庫的時候都要記住修改的埠,否則不能連線mysql資料庫,
比較麻煩,這裡不做修改,用mysq的預設埠:3306
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134336807.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134336807.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

12 這一步設定mysql的預設編碼,預設是latin1,也是標準的編碼
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134336376.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134336376.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

13 當然我們可以根據需要,把它改成gb2312或gbk。編碼是版本4.1以上引入的。
如果要用原來資料庫的資料,最好能確定原來資料庫用的是什麼編碼,如果這裡設定的編碼
和原來資料庫資料的編碼不一致,在使用的時候可能會出現亂碼.建議使用latin1標準編碼
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134337691.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134337691.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

14 這一步是是否要把mysql設定成windows的服務,一般選擇設成服務,
這樣以後就可以通過服務中啟動和關閉mysql資料庫了。推薦:下面的核取方塊也勾選上,
這樣,在cmd模式下,不必非到mysql的bin目錄下執行命令。在命令列下諮詢可以執行檔案
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134337450.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134337450.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

15 這一步是設定mysql的超級使用者密碼,這個超級使用者非常重要,
對mysql擁有全部的許可權,請設定好並牢記超級使用者的密碼,
下面有個核取方塊是選擇是否允許遠端機器用root使用者連線到你的mysql伺服器上面,
如果有這個需求,也請勾選。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134337855.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134337855.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

16 點選 Execute
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134338697.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134338697.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

17 到這一步
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134338325.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134338325.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

18 我們可以開始使用mysql了,開啟開始選單的 mysql Command line Client,輸入密碼
出現這個介面說明mysql已經安裝好了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134338105.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134338105.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

可能出現的問題:
如果在第15步,你出現的介面是像下面這樣
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134338728.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134338728.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>
有三個輸入密碼的地方,則有可能您是在原來基礎上安裝的。
你在第一個文字框輸入原來root的密碼,後面兩個文字框輸入root的新密碼,
點選Next基礎,出現下圖
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134339444.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134339444.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>
給您推薦幾種解決辦法:
1、        點Retry,重試;
2、         再執行一次設定,看到有關“移除原設定”的選項,選擇移除,然後在重新設定。
3、        重灌。
重灌注意事項:最好刪除原來的所有檔案,必要的話,可以清一下登錄檔,
如果你機器上沒有其它mysql相關的程式。而且一定記得不要保留原有的my.ini檔案。
還有就是刪除原來安裝路徑下的檔案,並刪除資料目錄下面的ibdata1檔案.
更多文章 php愛好者站 http://www.phpfans.net

PHP 的安裝

由於php是一個zip檔案(非install版),安裝較為簡單
解壓就行。把解壓的 php5.1.1-Win32重新命名為 php5。並複製到C盤目錄下。即安裝路徑為 c:\php5

1  找到php目錄下的 php.ini-dist或 php.ini.recommended檔案,重新命名為 php.ini
並複製到系統盤的windows目錄下(以c:\windows為例).

2  再把php目錄下的php5ts.dll,libmysql.dll複製到目錄 c:\windows\system32下。
如果沒把libmysql.dll複製到system32下,在重啟apache時可能會出現如下警告
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134339956.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134339956.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

3  把php5\ext目錄下的php_gd2.dll,php_mysql.dll,php_mbstring.dll檔案複製到c:\windows\system32下
如果沒有載入 php_gd2.dll  php將不能處理影象。沒有載入php_mysql.dll php將不支援mysql函式庫
php_mbstring.dll在後面使用phpmyadmin時支援寬字元

所有東西安裝完成後我們再進行配置

配置php並關聯MySQL
以下內容跟帖回覆才能看到
==============================

開啟c:\windows\php.ini檔案

1 設定擴充套件路徑
查詢 extension_dir 有這麼一行
extension_dir = “./”
將此行改成
extension_dir = “C:\php5\ext”
其中C:\php5是你安裝php的路徑。路徑不正確將無法載入dll
(注意:有些php版本是 ;extension_dir = “./” 要把前面的分號去掉)

2 查詢 extension
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_mysql.dl
把上面3項前面的分號去掉,這樣apache啟動時就可以載入這些dll了
當然前面我們也把這些dll複製到system32下了l

3 設定會話儲存路徑
查詢session.save_path 有這麼一行
;     session.save_path = “N;/path”
在此行後加入一行(注意是加入一行,不是加到後面)
session.save_path = “C:\WINDOWS\Temp”
儲存到你的臨時目錄下,這裡完全可以儲存到windows臨時目錄Temp下

4 還有比較值得注意的是 short_open_tag 預設是Off的
也就是說 php不能使用短標記如 <? ?> 必須使用<?php ?>
由於短標記使用方便,並且很多程式也是用短短標記來寫,如discuz等
如果不把 short_open_tag 改成On將出現的症狀將很難判斷是上面原因,這裡建議修改
查詢
short_open_tag = Off
改為
short_open_tag = On

5 是否顯示錯誤 display_errors
出於安全性考慮,display_errors 也預設為 Off
就是說在除錯時,如果php程式碼有誤,就只出現一個空白頁。而不會顯示出錯原因和出錯行數。
這樣除錯起來將非常不便,建議根據自己需要修改
查詢
display_errors = Off           (注意不是 ; – display_errors = Off           [Security])
改成
display_errors = On

6 register_globals
出於安全性考慮它預設也是Off
當register_globals=Off的時候,下一個程式接收的時候應該用$_POST[‘user_name’]和$_POST[‘user_pass’])
當register_globals=On的時候,下一個程式可以直接使用$user_name和$user_pass來接受值。
更詳細的說明請參考
http://www.phpfans.net/bbs/archiver/?tid-234.htm
建議根據自己需要修改

7 php5時差問題
<?php echo date(“Y-m-d H:i:s”);?>時間相差八小時
為什麼呢?PHP5系列版本新增了時區設定,預設為格林威治時間,與中國所在的東8區正好相差8個小時
查詢date.timezone有這麼一行
;date.timezone =
將;去掉,改成
date.timezone = PRC
其中PRC:People’s Republic of China 中華人民共和國,
更詳細解決方法請參考本論壇的
http://www.phpfans.net/bbs/archiver/?tid-60.html
更多文章 php愛好者站 http://www.phpfans.net

Apache整合PHP

1 從開始選單開啟apache配置文件,如圖
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134339950.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134339950.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

2 修改網站根目錄
查詢 DocumentRoot有這麼一行
DocumentRoot”C:/Program Files/Apache Group/Apache2/htdos”
這就是你網站的根目錄,你可以修改,也可以用預設的.如果改,還要修改下面這項,否則可能會出現 403 錯誤
查詢  This should be changed to whatever you set DocumentRoot to
在它下面兩行有
<Directory “C:/Program Files/Apache Group/Apache2/htdocs”>
把上面兩項的 C:/Program Files/Apache Group/Apache2/htdos 改成你想要的目錄

3 查詢  DirectoryIndex index.html index.html.var
修改成
DirectoryIndex index.html index.html.var  index.php
這樣index.php 可以充當預設頁面了

4 Apache中模組化安裝php
查詢 # LoadModule foo_module modules/mod_foo.so
在此行後加入一行
LoadModule php5_module C:/php5/php5apache2.dll

其中C:/php5/php5apache2.dll是你安裝php的相應路徑.
注意不要把php5apache2.dll和php5apache.dll混淆.php5apache.dll只適用於apache 版本1的.
注意: PHP5壓縮包裡的php5apache2.dll只適用於apache2.0.*版本,如果是2.2.*以上版本,就可能會出現
“Cannot load C:/php/php5apache2.dll into server: The specified module could not be found.”
或者:
“The requested operation has failed”
的情況.關於這個問題的解決方法可以參考本論壇的
http://www.phpfans.net/bbs/viewt … &extra=page%3D1

5 查詢 AddType application/x-gzip .gz .tgz
在此行後加入一行
AddType application/x-httpd-php .php
這樣apache就可以解釋php檔案了
到這裡配置基本完成了

########重啟apache#########

在網站根目錄下建立一個 phpinfo.php 檔案

<?php
phpinfo();
?>

在瀏覽器開啟
http://localhost/phpinfo.php
如果出現如下資訊,則說明php已經配置好了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134339543.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134339543.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

下面再測試php和mysql資料庫的關聯
在網站根目錄下建立一個test.php 檔案

CODE:
[Copy to clipboard]
<?php
$link
=mysql_connect("localhost","root","12345");  //12345改成你的mysql密碼
if(!$link) echo "失敗!";
else echo 
"成功!";
mysql_close();
?> 

在瀏覽器開啟 http://localhost/test.php
如果輸出成功,則說明大功告成了.

安裝 phpMyAdmin

下載得到 phpMyAdmin-2.7.0.zip,將其解壓到 你網站根目錄下並重新命名為phpMyAdmin,
找到並開啟 config.defaut.php (有些版本是config.inc.php或者 libraries/config.default.php)
做以下修改:

1 查詢 password 有如下兩行
$cfg[‘Servers’][$i][‘user’]          = ‘root’;     
$cfg[‘Servers’][$i][‘password’]      = ”;

把你的mysql密碼填到$cfg[‘Servers’][$i][‘password’]      = ”; 單引號裡邊

2 搜尋 $cfg[‘PmaAbsoluteUri’],將其設定為 phpMyAdmin 目錄路徑,如:http://localhost/phpMyAdmin/

下面這兩項項根據自己需要的編碼修改(如果對資料庫編碼不是很熟悉的建議不要修改)
3 搜尋 $cfg[‘DefaultLang’],將其設定為 zh-gb2312 ;
4 搜尋 $cfg[‘DefaultCharset’],將其設定為 gb2312 ;

開啟瀏覽器,輸入:http://localhost/phpMyAdmin/,Apache 和 MySQL 均已啟動,
如果出現如下頁面則phpmyadmin安裝完成並可以使用了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=’hand’; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” onclick=”if(!this.resized) {return true;} else {window.open(‘/upload/20061117134340474.jpg’);}” alt=”” src=”http://files.jb51.net/upload/20061117134340474.jpg” onload=”if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=’Click here to open new window\nCTRL Mouse wheel to zoom in/out’;}” border=”0″>

phpMyAdmin 的具體功能,請慢慢熟悉,這裡不再贅述。

==============================
更多文章 php愛好者站 http://www.phpfans.net