本文記錄在 Windows XP 上安裝配置 Apache 2.0.58、PHP 5.1.6、MySQL 5.0.19、Zend Studio Server 5.1.0a 及 phpMyAdmin 2.9.1 的完整步驟與設定檔修改要點,供開發者參考。
apache_2.0.58-win32-x86-no_ssl.msi — Apache 封存庫PHP-5.1.6-Win32.zipZendStudiOServer-5.1.0a-Windows-i386.exeMySQL-5.0.19-win32PHPMyAdmin-2.9.1D:/usr/)。httpd.conf 相關路徑參數。關鍵 httpd.conf 修改項目(範例路徑 D:/usr/apache2):
ServerRoot "D:/usr/apache2" ServerAdmin admin@example.com Listen 80 ServerName localhost:80 DocumentRoot "D:/usr/www" DirectoryIndex index.html index.htm index.php index.php3 index.php4 ScriptAlias /cgi-bin/ "D:/usr/apache2/cgi-bin/"
PHP-5.1.6-Win32.zip 至自訂路徑(範例:D:/usr/PHP5)。PHP 設定 (php.ini):
php.ini-dist 更名為 php.ini。doc_root = "D:/usr/www"(與 Apache DocumentRoot 一致)extension_dir = "D:/usr/PHP5/ext"include_path = "D:/usr/PHP5/includes"extension=php_mysql.dll 前的分號,並將 libmysql.dll 複製到 C:\Windows\System32(或 C:\WinNT\System32)。Apache 設定 (httpd.conf 末尾新增):
AddLanguage zh-cn .cn DefaultLanguage zh-cn AddDefaultCharset GB2312 ScriptAlias /php/ "D:/usr/PHP5/" LoadFile "D:/usr/PHP5/php5ts.dll" LoadModule php5_module "D:/usr/PHP5/php5apache2.dll" PHPIniDir "D:/usr/PHP5/" AddType application/x-httpd-php .php .php3 .php4 .phtml AddType application/x-httpd-php-source .phps
路徑請依實際安裝位置調整。
D:/usr/www 建立 test.php,內容:<?php phpinfo(); ?>https://localhost/test.php,若顯示 PHP 資訊頁即代表配置成功。C:\mysql\bin\winmysqladmin.exe,出現初始資訊視窗即代表成功。D:/usr/phpMyAdmin)。config.inc.php:
$cfg['PmaAbsoluteUri'] = 'https://localhost/phpMyAdmin';$cfg['blowfish_secret'] = 'admin';$cfg['Servers'][$i]['auth_type'] = 'cookie';$cfg['Servers'][$i]['user'] = '您的 MySQL 使用者';$cfg['Servers'][$i]['password'] = '您的 MySQL 密碼';httpd.conf 新增別名與權限設定:
Alias /phpMyAdmin "D:/usr/phpMyAdmin"
<Directory "D:/usr/phpMyAdmin">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "D:/usr/phpMyAdmin"
</Directory>
https://localhost/phpMyAdmin 驗證。ZendStudiOServer-5.1.0a-Windows-i386.exe 安裝即可。