【轉】 Windows下LAMP環境搭建

spectre2發表於2012-11-14

++++++++++++++++++++++++++++++++++++++++++++++
Windows下LAMP環境搭建
++++++++++++++++++++++++++++++++++++++++++++++
作業系統    : [windows xp professional sp3]
伺服器     : [apache-2.2.8]
PHP      : [php-5.2.17]
資料庫     : [mysql-5.1.49]
資料庫管理工具 : [phpmyadmin-3.3]
++++++++++++++++++++++++++++++++++++++++++++++
準備安裝軟體(download)
 1> [apache_2.2.8-win32-x86-openssl-0.9.8g]
      http://archive.apache.org/dist/httpd/binaries/win32/apache_2.2.8-win32-x86-openssl-0.9.8g.msi
 2> [php-5.2.17-Win32-VC6-x86]
      http://windows.php.net/downloads/releases/php-5.2.17-Win32-VC6-x86.zip
 3> [mysql-5.1.49]
      http://www.mysql.com/downloads/mirror.php?id=398365(需註冊)
 4> [phpMyAdmin-3.3.9-all-languages]
      http://sourceforge.net/projects/phpmyadmin/files%2FphpMyAdmin%2F3.3.9%2FphpMyAdmin-3.3.9-all-languages.zip/download#!md5!3d5ec3d2023946bbca9c4dd182722c8b
++++++++++++++++++++++++++++++++++++++++++++++
開始安裝(安裝前建立目錄[D:/lamp])
D:/lamp
 --apache2.2
 --php
 --mysql
 --sites
----------------------------------------------------------------------------
1>  【apache】
----------------------------------------------------------------------------
 1.1> Welcome to the Installation Wizard for Apache HTTP Server 2.2.8
   #單擊[Next>]
 1.2> License Agreement
   #選擇(I accept the terms in the license agreement)->單擊[Next>]
 1.3> Read This First
   #單擊[Next>]
 1.4> Server Information
   Network Domain(e.g.somenet.com): [helloworld.com]
   Server Name(e.g.www.somenet.com): [www.helloworld.com]
   Administrator's Email Address(e.g.webmaster@somenet.com): [helloworld@helloworld.com]
   #選擇(for All Users, on Port 80, as a Service  -- Recommended.), 單擊[Next>]
 1.5> Setup Type
   #選擇(Custom), 單擊[Next>]
 1.5> Custom Setup
   單擊[Change...],
  1.5.1>  Change Current Destination Folder
    Folder name: [D:/lamp/apache2.2/], 單擊[OK], 
   #單擊[Next>]
 1.6> Ready to Install the Program
   #單擊[Install]
 1.7> Installaction Wizard Completed
   #單擊[Finish]  
----------------------------------------------------------------------------   
2> 【php】
 2.1> 將php-5.2.17-Win32-VC6-x86.zip解壓到[D:/lamp/php]
----------------------------------------------------------------------------
3> 【mysql】
 3.1> Welcome o the Setup Wizard for MySQL Server 5.1
   #單擊[Next>]
 3.2> Setup Type
   #選擇Custom, 單擊[Next>]
 3.3> Custom Setup
  3.3.1> 單擊[Change...], 
  3.3.2>  Change Current Destination Folder
    Folder name: [D:/lamp/mysql/]
    單擊[OK]
   #單擊[Next>]
 3.4> Ready to Install the Program
   #單擊[Install]
 3.5> A MySQL Enterprise subscription is the most...
      #單擊[Next>]
 3.6> The MySQL Enterprise Monitor Service
   #單擊[Next>]
 3.7> Wizard Completed
   #勾選[Configure the MySQL Server now]
   #單擊[Finish]
 3.8> Welcome to the MySQL Service Instance Configuration Wizard 1.0.17.0
   #單擊[Next>]
 3.9> MySQL伺服器例項配置[MySQL Server Instance Configuration]
   Detailed Configuration-詳細配置
   Standard Configuration-標準配置
   #選擇預設[Detailed Configuration]
   #單擊[Next>]  
  3.9.1> 伺服器型別[Please select a server type. This will influence memory, disk and CPU usage.]
    [Developer Machine]-開發伺服器, 佔用記憶體較少
    [Server Machine]-多個伺服器共用, 佔用記憶體中等
    [Dedicated MySQL Server Machine]-專用伺服器, 佔用記憶體較多
    #選擇預設[Developer Machine]
    #單擊[Next>]
  3.9.2>  資料庫用途[Please select the database usage]
    [Multifunctional Database]-多功能資料庫,優化InnoDB,MyISAM 
    [Transactional Database Only]-事務資料庫,優化InnoDB,MyISAM也可用
    [Non-Transactional database Only]-非事務性資料庫,適用於簡單的網路監控或記錄的應用發有分析僅非事務的MyISAM引擎
    #選擇預設[Multifunctional Database]
    #單擊[Next>]   
  3.9.3>  InnoDB的資料檔案的存放位置[Please select the driver for the InnoDB datafile, if you do not want to use the default settings]s
    #選擇預設
    #單擊[Next>]
  3.9.4>  設定併發連線到伺服器的大致數量[Please set the approximate number of concurrent connections to the server]
    [Decision Support(DSS)/OLAP]-併發數20
    [Online Transaction Processing(OLTP)]-併發數500
    [Manual Setting]-併發數自定義
    #選擇[Manual Setting], Concurrent connections[100]
    #單擊[Next>]
  3.9.5>  [網路選項]Please set the networking options
    [Enable TCP/IP Networking]-啟用TCP/IP網路
    [PortNumber:[3306]]-埠
    [Add firewall exception for this port]-新增到防火牆例外
    [Enable Strict Mode]-啟用嚴格模式
    #選擇預設[Next>]
  3.9.6>  [選擇字符集]Please select the default character set.
    [Standard Character set]-預設Latine 適用於英文或其它西歐語言
    [Best Support For Multilingualism]-支援多種語言
    [Manual Selected Default Character Set/Collation]-自定義
    #選擇[Best Support For Multilinguatilsm]
    #單擊[Next>]
  3.9.7>  設定Windows選項[Please set the Windows options]
    [Install As Windows Service[安裝為windows服務]
    [Launch the MySQL Server automatically[自啟動]
    [Include Bin Directory in Windows PATH[加入環境變數]
    #選擇預設
    #單擊[Next>]
  3.9.8>  設定安全選項[Please set the security options]
    [Current root password]-舊密碼,留空
    [New root password]-新密碼,
    [Confirm]-確認新密碼
    [Enable root access from remote machines]-啟用root帳號遠端訪問
    [Create An Anonymous Account]-建立匿名帳號
    #輸入密碼和確認密碼, 其它預設
    #單擊[Next>]
  3.9.9> 準備執行[Ready to execute...]
    #單擊[Execute]
  3.9.10> Processing configureation...
    #單擊[Finish]
----------------------------------------------------------------------------   
4> 【phpMyAdmin】
 4.1> 將phpMyAdmin-3.3.9-all-languages.zip解壓到[D:/lamp/sites/phpmyadmin/]
----------------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++
【apache配置】
 5.1> httpd.conf(D:/lamp/apache2.2/conf)
  5.1.1>  #功能: 載入php模組
    #說明: 搜尋LoadModule, 在其後面新增
    LoadModule  php5_module "D:/lamp/php/php5apache2_2.dll"
  
  5.1.2> #功能: 設定工作目錄
    #說明: 搜尋DocumentRoot, 修改為
    DocumentRoot "D:/lamp/sites"
    
  5.1.3> #功能: 設定目錄選項
    #說明: 搜尋, 修改為
    

  5.1.4> #功能: 設定預設文件
    #說明: 搜尋, 新增
    DirectoryIndex index.php index.html

  5.1.5>  #功能: 增加php型別
         #說明: 在檔案末尾加入
       AddType application/x-httpd-php .html .php

       #功能: php.ini所在目錄
       #說明: 在檔案末尾加入
       PHPIniDir "D:/lamp/php"
      
       功能: 不允許訪問目錄
    說明: 搜尋Options Indexes FollowSymLinks項,並註釋
       #Options Indexes FollowSymLinks

 5.2> 注意: 修改配置檔案後, 重啟apache才能生效

 5.3> 在D:/lamp/sites/建立檔案
     #phpinfo.php
     輸入內容:
         phpinfo();
     ?>
     訪問:http://localhost/phpinfo.php
      
【php配置】
 6.1> php.ini
  6.1.1> D:/lamp/php/php.ini, 複製php.ini-recommended並重新命名為php.ini
  6.1.2> #功能: 指定擴充套件庫所在目錄
    extension_dir = "D:/lamp/php/ext/"

    #功能: 開啟擴充套件
    #說明: 根據需要開啟相應擴充套件模組, 去掉前面的分號
    extension=php_gd2.dll
    extension=php_mbstring.dll
    extension=php_mcrypt.dll
    extension=php_mysql.dll
    extension=php_mysqli.dll

      #功能: 設定時區
      #說明: PRC表示中國
      date.timezone = PRC
      
      #功能: 顯示錯誤資訊
      display_errors = On
 6.2> 複製libmysql.dll, libmcrypt.dll(D:/lamp/php)到C:/WINDOWS/system32/
 6.3> 重啟apache,訪問http://localhost/phpinfo.php,檢視相應擴充套件是否載入成功
++++++++++++++++++++++++++++++++++++++++++++++

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14184018/viewspace-749236/,如需轉載,請註明出處,否則將追究法律責任。

相關文章