Windows 7 下 PHP 開發環境搭建

來源:互聯網
上載者:User
第一部分:安裝Apache2.4.4

1.下載檔案:httpd-2.4.4-win32-ssl_0.9.8.zip

2.解壓安裝:將Apache24檔案夾拷到C盤根目錄

3.開啟C:\Apache24\conf檔案夾下面的httpd.conf檔案,用記事本開啟即可

4.第213行ServerName前面的“#”號去掉;

5.第237行DocumentRoot "c:/Apache24/htdocs"改為"E:/WorkSpace/WWW"

6.第238行<Directory "c:/Apache24/htdocs">改為"E:/WorkSpace/WWW">

note:WWW檔案夾為網站的根目錄,需要自己建立,否則會報錯。

7.第271行DirectoryIndex index.html改為DirectoryIndex index.php index.html index.htm

第二部分:安裝PHP5.4.15

1.下載檔案:php-5.4.15-Win32-VC9-x86.zip

2.解壓安裝:解壓檔案,拷到C盤根目錄,改名為PHP54

3.複製份php.ini-development,並改名為PHP.ini

4.開啟C:\Apache24\conf檔案夾下面的httpd.conf檔案,在#LoadModule xml2enc_module modules/mod_xml2enc.so下面添加如下資訊

LoadModule php5_module "C:/PHP54/php5apache2_4.dll"PHPIniDir "C:\PHP54"AddType application/x-httpd-php .php .html .htm

 5.在WWW檔案夾中建立index.php,檔案內容如下

<html><head><title>Test PHP5</title></head><body><center><h1>This is test information</h1></center><hr><?phpphpinfo();?></body></html>

6.啟動Apache伺服器:在cmd視窗中啟動(測試過程中視窗不能關閉,否則服務停止)

7.在瀏覽器中輸入http://localhost/如果出現以下資訊,則表明配置成功

NOTE:1.讓php支援MySQL:
將第730行; extension_dir = "C:\PHP54\ext"改為extension_dir = "C:\PHP54\ext"將第880、881行; extension=php_mysql.dll; extension=php_mysqli.dll改為extension=php_mysql.dllextension=php_mysqli.dll
 2.將Apache添加到系統服務:

添加服務:

"C:\Apache24\bin\httpd.exe" -k install -n "Apache 2.4.4" -f "C:\Apache24\conf\httpd.conf"

 刪除服務:

"C:\Apache24\bin\httpd.exe" -k uninstall -n "Apache 2.4.4"

 開始服務:

"C:\Apache24\bin\httpd.exe" -k start -n "Apache 2.4.4"

 停止服務:

"C:\Apache24\bin\httpd.exe" -k stop -n "Apache 2.4.4"or"C:\Apache24\bin\httpd.exe" -k shutdown -n "Apache 2.4.4"

 重啟服務:

"C:\Apache24\bin\httpd.exe" -k restart -n "Apache 2.4.4"

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.