Fork me on GitHub

Windows下搭建PHP开发环境

1 安装Apache2.4   http://httpd.apache.org/ 

 

2 安装PHP5.6     http://php.net/

 

3 配置Apache

  配置文件 httpd.conf ,让Apache可以解析php文件

  添加:

LoadModule php5_module "D:/IT/php-5.6/php5apache2_4.dll"

AddType application/x-httpd-php .php .html .htm

  修改:

DirectoryIndex index.html    =>   DirectoryIndex index.php index.html        #设置默认打开的文件名称

  修改Apache站点目录(可选):

DocumentRoot "D:/IT/Apache2.4/htdocs"    =>    DocumentRoot "D:/Workspace/PHP"        #http://127.0.0.1的文档根目录

<Directory "D:/IT/Apache2.4/htdocs">     =>     <Directory "D:/Workspace/PHP">        #设置该目录的访问权限
 

  

4 配置PHP

  配置文件 php.ini-development => php.ini 

  设置PHP扩展包的具体目录:

; On windows
; extension_dir = "ext"      =>      extension_dir = "D:/IT/php-5.6/ext" 

  开启相应的库功能:

extension=php_curl.dll

extension=php_gd2.dll

extension=php_mbstring.dll

extension=php_mysql.dll

extension=php_xmlrpc.dll

  设置时区:

;date.timezone =      =>     date.timezone = Asia/Shanghai

 

测试

  在根目录新建一个 hello.php 

<?php

    phpinfo();

?>

浏览器访问地址:http://127.0.0.1/PHP/hello.php

posted @ 2016-04-13 14:31  Roronoa__Zoro  阅读(163)  评论(0编辑  收藏  举报