官網下載最高版本號的 Apache,現在是 2.2 版。個人開發網頁不需要 HTTPS 支援,選擇下載 Win32 Binary without crypto (no mod_ssl) (MSI Installer) 提供的檔案。

安裝過程中的 Server Information 必需填寫以下內容:Network Domain 和 Server Name 都填 127.0.0.1;Administrator's Email Address 隨便填,這個 Email 是用來在網頁訪問出錯時顯示、供網友回報錯誤。
Apache_HTTP_Server2.2_Installation_Wizard_Server_Information

安裝類型選擇 Typical
Apache_HTTP_Server2.2_Installation_Wizard_Setup_Type

安裝路徑點 Change,變更為 C:\Apache\
Apache_HTTP_Server2.2_Installation_Wizard_Destination_Folder

Apache 裝好後為測試安裝是否成功,可使用瀏覽器訪問 127.0.0.1,會顯示 It works!

至 PHP 官網下載 PHP,下載 Windows Binaries 中的第一個壓縮檔,現在是 PHP 5.2.9-2 zip package。下載得到的壓縮檔解壓縮到 C:\PHP\,將其中的 php.ini-recommended 重新命名為 php.ini。

我的電腦(點右鍵)» 內容 » 進階 » 環境變數,點上方的新增,新增使用者變數:變數名稱 PATH;變數值 C:\PHP
PHP_PATH_variable_on_Windows

開始 » 程式集 » Apache HTTP Server 2.2 » Configure Apache Server » Edit the Apache httpd.conf Configuration File。在 httpd.conf 末尾加入以下內容:

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"


開始 » 執行 » services.msc,開啟本機服務管理,重新啟動服務 Apache2.2。會看到服務描述變為

Apache/2.2.11 (Win32) PHP/5.2.9-2


測試 PHP 環境是否工作:至 C:\Apache\htdocs,新增一個文字文件 phpinfo.php,輸入以下內容。

<?php phpinfo() ?>

然後訪問 http://127.0.0.1/phpinfo.php 就會看到當前 PHP 的詳細配置資訊及版本情報。

測試 PHP 語法高亮是否工作:將上述的 phpinfo.php 重新命名為 phpinfo.phps,然後訪問 http://127.0.0.1/phpinfo.phps 就會看到以語法高亮顯示出的 PHP 原始碼。

arrow
arrow
    全站熱搜

    呆丸北拜 發表在 痞客邦 留言(0) 人氣()