原文地址:http://blog.csdn.net/yehell/archive/2008/01/25/2064853.aspx
本文檔就
對
Windows XP
系
統
下如何安裝配置
PHP
、
Mysql
、
Apache
進
行
說
明。
以下
為
本
說
明所要用到的
軟
件。
-
apache_2.2.4-win32-x86-no_ssl.msi-- www.apache.com
-
php5.2-win32-200703061530.zip-- www.php.net
-
MySQL 5.0.
18
-- www.mysql.com
-
Eclipse3.2
-
net.sourceforge.phpeclipse_1.1.8.bin.dist.zip
-
wampp-2.2.zip
-
HardCoreWCM630_php.zip
????? 嚴
重注意:在
進
行下列操作前,
Windows XP
應
無安裝
IIS
、
PHP
、
APACHE
、
MYSQL
、
ZEND
。
≡ Apache 2.2.4
的安裝
≡
-
打
開
我的
電腦
,
進
入
D
盤
,在其下新建一個文件
夾
,名
為
local
。
-
到其官方站點下
載
apache_2.2.4-win32-x86-no_ssl.msi
并
執
行。
-
按
3
次
Next
按
鈕
,安裝程序要求
輸
入你的
Network Domain
(網
絡
域名)、
Server Domain
(服
務
器域名)和網站管理
員
的
E-mail
,有的
話
就如
實
填寫,本
說
明介
紹
的是本地自建
測試環
境,所以隨便一下,前兩個填
localhost
,
郵
件寫自己的即可。
-
進
入
Next
后,默
認
的安裝路徑是
"C:\Program Files\Apache Software Foundation\Apache2.2\"
,修改路徑,改
為
前面所述的
"D:\local\Apache2"
。
-
然后一路下去,直到安裝
結
束;此
時
,打
開
D
盤
下的
local
文件
夾
,可以看到有一個名
為
Apache2
的文件
夾
。
-
打
開
IE
,然后在地址
欄輸
入:
"http://localhost"
或者
"http://127.0.0.1"
可以看到
Apache
安裝完成的成功
頁
面;以后網
頁
的存在位置就在
"D:\local\Apache2\htdocs"
目
錄
。
≡ PHP 5.2.0
的安裝
≡
-
到其官方站點下
載
php-5.2.0-Win32.zip
并解
壓
(在此不要下
載
及使用它的
Installer
,
這種
方式
雖
然很自
動
化、很智能,但也存在很多方面的限制,因
為
不推薦。)
-
將
PHP
文件解
壓
到一個目
錄
下,目
錄
地址
為
"D:\local\php"
。
-
將
PHP
目
錄
(
D:\local\php
)下的
php.ini-dist
復
制到
windows
(有的系
統
是
winnt
目
錄
)目
錄
下,并改名
為
php.ini
。
-
復
制
D:\local\php
目
錄
下的所有
dll
文件到
windows
的系
統
文件
夾
里,即:
C:\windows\system32
。
-
php5
安裝
pear
-
從
99
服務器下載
go-pear.phar
文件放在
D:\local\php\PEAR
目錄下
-
運行
cmd
-
執行
D:\local\php> go-pear.bat
運行結果:
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system
Below is a suggested file layout for your new PEAR installation.? To
change individual locations, type the number in front of the
directory.? Type 'all' to change all of them or simply press Enter to
accept these locations.
?1. Installation base ($prefix)??????? : F:\local\php
?2. Temporary directory for processing : F:\local\php\tmp
?3. Temporary directory for downloads? : F:\local\php\tmp
?4. Binaries directory???????????????? : F:\local\php
?5. PHP code directory ($php_dir)????? : F:\local\php\pear
?6. Documentation directory??????????? : F:\local\php\pear\docs
?7. Data directory???????????????????? : F:\local\php\pear\data
?8. Tests directory??????????????????? : F:\local\php\pear\tests
?9. Name of configuration file???????? : C:\WINDOWS\pear.ini
10. Path to CLI php.exe??????????????? : F:\local\php\.
1-10, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\WINDOWS\pear.ini...
Initialized registry...
Preparing to install...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.2.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.6.1.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar.
..
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
install ok: channel://pear.php.net/Archive_Tar-1.3.2
install ok: channel://pear.php.net/Console_Getopt-1.2.3
install ok: channel://pear.php.net/Structures_Graph-1.0.2
install ok: channel://pear.php.net/PEAR-1.6.1
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
******************************************************************************
WARNING!? The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<F:\local\php\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.
Would you like to alter php.ini <C:\WINDOWS\php.ini>? [Y/n] : Y
php.ini <C:\WINDOWS\php.ini> include_path updated.
Current include path?????????? : .;C:\php5\pear
Configured directory?????????? : F:\local\php\pear
Currently used php.ini (guess) : C:\WINDOWS\php.ini
Press Enter to continue:
** WARNING! Old version found at F:\local\php, please remove it or be sure to us
e the new f:\local\php\pear.bat command
The 'pear' command is now at your service at f:\local\php\pear.bat
** The 'pear' command is not currently in your PATH, so you need to
** use 'f:\local\php\pear.bat' until you have added
** 'F:\local\php' to your PATH environment variable.
Run it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.
For more information about PEAR, see:
? http://pear.php.net/faq.php
? http://pear.php.net/manual/
Thanks for using go-pear!
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under F:\local\php\PEAR_ENV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
請
按任意
鍵繼續
. . .
-
執行
pear.bat install db
運行結果:
F:\local\php>pear.bat install db
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
downloading DB-1.7.13.tgz ...
Starting to download DB-1.7.13.tgz (132,246 bytes)
.............................done: 132,246 bytes
install ok: channel://pear.php.net/DB-1.7.13
-
完成安裝!
≡ MySQL 5.0.27
的安裝
≡
-
打
開
我的
電腦
,
進
入
D:\local
,在其下新建一個文件
夾
,名
為
mysql
。
-
到其官方站點下
載
Mysql 5.0.27 Installer
并
執
行。
-
按
Next
,然后
選擇
Custom
安裝方式。
-
點
擊
Change
,改
變
安裝路徑;原路徑是
"C:\Program Files\MySQL\MySQL Server 5.0\"
,
這
里改
為
:
"D:\local\mysql\"
。
-
等安裝
進
度條
load
完
時
,會出
現
一個
Sign Up
向
導
,
這
里不用理,
選擇
最下面的那個
Skip Sign-Up
,然后
Next
,上面有個
"Configure the MySQL Server now"
是打勾的,不要去掉,直接點
Finish
。
-
現
在
開
始安裝最后的配置,點
Next
,
選擇
Detailed Configuration
,然后
選擇
第二個
Server Machine
。
-
再
Next
,
選擇
Non-Transactional Database Only
。
-
再
Next
,
選擇
Manual Setting
,
連
接數
選擇
200
到
300
,在此因
為
是本機
測試
,所以此
項
并不重要。
-
再
Next
,是
設
置其的端口,默
認
是
3306
,不要
動
它。
-
再
Next
,
選擇
Manual Selected Default Character Set / Collation
,在下面的
Character Set
選擇
gbk
。
-
再
Next
,在
Include Bin Directory in Windows PATH
前打勾。
-
再
Next
,在
Modify Security Settings
前的勾取消,因
為
是本地
環
境,非服
務
器和虛
擬
主機。
-
最后一個
Next
再加
Execute
,可以看到上面的
步驟
全部完成。
-
MySQL
的
帳
號是:
root
,密
碼為
空。
-
檢測
MySQL
,
鍵盤
的
Win + R
,
彈
出運行
對話
框,
輸
入
cmd
后回
車
,
進
入命令提示符,然后
輸
入:
"mysql -uroot -p"
,回
車
后要求
輸
入密
碼
,因
為
密
碼為
空,所以直接再按回
車
即可。
現
在可以看到如下成功的提示:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.27-community-nt
Type 'help;' or '\h' for help.
Type '\c' to clear the buffer.
表示全部安裝成功。
-
操作符
變
成了
"mysql>"
,
鍵
入
exit
退出即可。
≡
eclipse
3.2
配置
phpeclipse1.1.8
≡
注意:由于版本兼容問題建議使用
eclipse3.1.X+
phpeclipse1.1.8
,建議安裝方式為在線
update
。
Eclipse
會自動識別匹配插件。
-
解壓
eclipse.zip
到任一目錄
-
把
net.sourceforge.phpeclipse_1.1.8.bin.dist.zip
解壓到
eclipse
文件夾下
-
修改
eclipse
的目標位置
E:\eclipse\eclipse.exe –clean
-
重啟
eclipse
完成插件安裝!
-
新建PHP
項
目:
第一
步
:
File -> New -> Project
,看看,有
PHP Project
。
第二步:設置項目名,項目目錄。項目目錄需要和在上面設置的
Apache
的
DocumentRoot
所設置的目錄相同,才能通過瀏覽器訪問,以方便調試。
然后
finish
,創建完畢。
注:在
eclipse
的
windows
菜單下,選
Preferences
,再在左側找到
PHPeclipse Web development
,并選中可以修改
PHP
插件屬性。
還有內置的幫助
系統
需要用到
php
的官方
chm
文件,可以到這里下載:
http://www.php.net/download-docs.php
復制到
c:\wampp2\php\php_manual_en.chm
,就可以了,路徑也可以在剛才的配置選項里設置。
≡ Apache
與
PHP
的配置
≡
-
開
始菜
單
的程序的
Apache HTTP Server 2.2.4
,再
進
入下一
級
的
Configure Apache Server
,
這時
可以看到那個
Edit the Apache
httpd.conf
Configuration File
。點一下。
-
查
找:
#LoadModule ssl_module modules/mod_ssl.so
在下面添加:
LoadModule php5_module "d:/local/php/php5apache2_2.dll"
-
查
找:
DirectoryIndex index.html
替
換
:
DirectoryIndex index.html index.htm index.php default.php
-
查
找:
AddType application/x-gzip .gz .tgz
在下面添加:
AddType application/x-httpd-php .php
-
如需修改網頁默認目錄則查找:
DocumentRoot
修改默認目錄為
DocumentRoot "e:workspace"
同時修改
<Directory "e:workspace">
-
Apache
配置
結
束,
現
在
開
始
進
行
PHP
配置,用
Notepad
打
開
C:\windows\php.ini
。
-
查
找:
extension_dir = "./"
替
換
:
extension_dir = "d:/local/php/ext/"
-
查
找:
upload_max_filesize = 2M
這
里的意思
為
修改上
傳
文件的最大限制,默
認為
2M
,可以改
為
6M
。
-
查
找:
;extension=php_mbstring.dll
將前面的
;
號去掉。
-
查
找:
;extension=php_gd2.dll
將前面的
;
號去掉。
-
查
找:
;extension=mysql.dll
將前面的
;
號去掉。
-
查
找:
;date.timezone =
替
換
:
date.timezone = PRC
-
文件修改完
畢
,此
時
,雙
擊
右下角任
務欄
的
Apache
圖標
,
彈
出的窗口中,點
Stop
停止服
務
,等停止后再點
Start
啟
動
服
務
,此
時
,可以看到其窗口的狀
態欄
中會
顯
示:
"Apache/2.2.4 (Win32) PHP/5.2.0"
。
配置全部完成。
≡ phpMyAdmin 2.9.2
的安裝
≡
-
到其官方站點下
載
phpMyAdmin-2.9.2.zip
并解
壓
,并更改目
錄
名
為
phpmyadmin
,然后移
動
到
"D:\local\Apache2\htdocs"
。
-
編輯
:
libraries
下的
config.default.php
。
-
查
找:
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
// with 'config' auth_type)
$cfg['Servers'][$i]['nopassword'] = FALSE; // Whether to try to connect without password
$cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only
// this db is displayed in left frame
// It may also be an array of db-names, where sorting order is relevant.
這
里由于是本地
測試環
境,所以所按默
認值
,不需要更改。
-
查
找:
$cfg['DefaultLang'] = 'en-iso-8859-1';
替
換
:
$cfg['DefaultLang'] = '
UTF-8
';
-
查
找:
$cfg['DefaultCharset'] = 'iso-8859-1';
替
換
:
$cfg['DefaultCharset'] = '
UTF-8
';
-
設
置完成。
現
在打
開
IE
,
鍵
入:
"http://localhost/phpmyadmin"
,即可
進
行相
關
操作。
≡
wampp2.2
的安裝
≡
-
解壓
wampp-2.2.zip
到
d:\local\
解
壓
后的目
錄結
構
應該
如下
圖
所示:
wampp
包含了下面的
內容
:
+ Apache 2.0.46
+ MySQL 4.0.13
+ PHP 4.3.2 + PEAR
+ Perl 5.8.0
+ mod_php 4.3.2
+ mod_perl 1.99_10 dev
+ mod_ssl 2.0.46
+ mod_auth_mysql (only experimental)
+ openssl 0.9.7b
而且已經都配置好了,需要咱們修改的
內容
不多,
第一個應該改一下
Apache
的
DocumentRoot
,這是
Web
服務的根目錄,
這里咱把它設置為
D:\workspace
,等會兒
Eclipse
的工作目錄也要設置到這個位置。
其它的就可以根據自己的需要另行配置。
-
安裝
Apache
為
系統
服務
把
Apache
安裝為
service
,進入目錄
C:\wampp2\apache
,雙擊
apache_installservice.bat
即可把
Apache
安裝成
系統
的
service
。
修改
eclipse
的目標位置
E:\eclipse\eclipse.exe –clean
打
開
"
控制面板
"
里的
"管理工具"
,找到
"
服
務
"
,就會看到
Apache2
這
一些,
雙
擊
,打
開
"Apache2
屬性
"
的,把
"
啟
動類
型
"
設
置
為
"
手
動
"
,
這樣
可以
節
省一下
系
統
資
源,
加快
開
機的速度,是我個人的
習慣問題
,可以不用改,
開
機自
動
啟
動
Apache
也可以。
≡
HardCore
的安裝
≡
-
解壓
HardCoreWCM630_php.zip
到
apache
的默認目錄(
document
)下
-
重啟
apache
在
IE
中運行
http://localhost/webadmin/
顯示登陸頁面配置成功??!
1