日期:2014-05-17  浏览次数:20736 次

windows下php配置apache
   
  • 注意: 记住当在 Windows 环境下的 Apache 配置文件中添加路径值时,所有的反斜线,如 c:\directory\file.ext,应转换为正斜线: c:/directory/file.ext。对目录来说,也必须由斜线结尾。


在httpd.conf最后一行追加如下:
       
 # 
   LoadModule php5_module "c:/php/php5apache2.dll"
   AddHandler application/x-httpd-php .php

    # configure the path to php.ini
    PHPIniDir "C:/php"
#The above configuration will enable PHP handling of any file that has a .php extension, 
#even if there are other file extensions. For example, a file named example.php.txt will be executed by the PHP handler. 
#To ensure that only files that end in .php are executed, use the following configuration instead: 
<FilesMatch \.php$>
      SetHandler application/x-httpd-php
 </FilesMatch>



引用
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

index.html 后面加上 index.php,变成:
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>


在php.ini最后加入:
# php timezone configure
date.timezone = "Asia/Shanghai"

date.default_latitude = 31.5167
date.default_longitude = 121.4500 



以上来自官方文档: http://cn2.php.net/manual/zh/install.windows.apache2.php