免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2424 | 回复: 0
打印 上一主题 下一主题

windows下php配置apache [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-11-17 14:27 |只看该作者 |倒序浏览
windows下php配置apache






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


在httpd.conf最后一行追加如下:
        
Java代码
  1. 1. #   
  2. 2.   LoadModule php5_module "c:/php/php5apache2.dll"  
  3. 3.   AddHandler application/x-httpd-php .php   
  4. 4.  
  5. 5.    # configure the path to php.ini   
  6. 6.    PHPIniDir "C:/php"  
  7. 7.#The above configuration will enable PHP handling of any file that has a .php extension,   
  8. 8.#even if there are other file extensions. For example, a file named example.php.txt will be executed by the PHP handler.   
  9. 9.#To ensure that only files that end in .php are executed, use the following configuration instead:   
  10. 10.<FilesMatch \.php$>   
  11. 11.      SetHandler application/x-httpd-php   
  12. 12. </FilesMatch>  
  13. #
  14.    LoadModule php5_module "c:/php/php5apache2.dll"
  15.    AddHandler application/x-httpd-php .php

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


引用
  1. <IfModule dir_module>
  2.     DirectoryIndex index.html
  3. </IfModule>
复制代码
index.html 后面加上 index.php,变成:

Java代码
  1. 1.<IfModule dir_module>   
  2. 2.    DirectoryIndex index.html index.php   
  3. 3.</IfModule>  
  4. <IfModule dir_module>
  5.     DirectoryIndex index.html index.php
  6. </IfModule>
复制代码
在php.ini最后加入:

Java代码
  1. 1.# php timezone configure   
  2. 2.date.timezone = "Asia/Shanghai"  
  3. 3.  
  4. 4.date.default_latitude = 31.5167  
  5. 5.date.default_longitude = 121.4500   
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP