2010年11月2日 星期二

安裝 Apache 2.2 和 設定PHP5

複製自php安裝目錄install.txt L652~L673
內容看起來是安裝php5到apache1.3
Installing as an Apache module

    You should add the following lines to your Apache httpd.conf file:

    Example 2-3. PHP as an Apache 1.3.x module

    This assumes PHP is installed to c:\php. Adjust the path if this is not the case.

    For PHP 5:
# Add to the end of the LoadModule section
LoadModule php5_module "C:/php/php5apache.dll"  我的路徑不一樣,檔案則是php5apache2_2.dll

# Add to the end of the AddModule section
AddModule mod_php5.c 在apache2.2中沒有AddModule所以我沒有用


    For both:
# Add this line inside the <ifmodule> conditional brace</ifmodule>
AddType application/x-httpd-php .php

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps 這一行也沒有設定

參考上面的文件,

  1. 安裝完apache2.2,
  2. 安裝PHP5
  3. 設定httpd.conf
    • LoadModule php5_module "C:\Program Files\PHP\php5apache2_2.dll"
    • <IfModule php5_module>
          AddType application/x-httpd-php .php
      </IfModule>
    • <IfModule dir_module>
          DirectoryIndex index.php index.htm index.html
      </IfModule>

    接著,就是測試了,重點只有不要吧PHP的括胡用錯。 Orz

<?
    phpinfo();
?>

PS.使用PHP5.2.14和PHP5.3.3的msi包裝安裝,在選擇了某些extension時,會讓Apache開不起來。

沒有留言:

張貼留言