Windows中Apache配置

  • Apache安装

httpd-2.2.25-win32-x86-openssl-0.9.8y.msi这个文件在64位的win7上面可以安装,32的也可以

安装完成后显示下面结果就算是安装成功了。端口可自己修改!

解压php,这里直接把我之前的php文件拷贝到指定位置。

在php.ini中设置:extension_dir="D:/php/ext/",php.ini中extension_dir ="c:/php/ext/"  这个一定要注意,否则gd库找不到。

在apache中httpd.conf添加:

LoadModule php5_module C:/php/php5apache2_2.dll

AddType application/x-httpd-php .php .phtml

PHPIniDir C:/php

取消下面两个注释(httpd.conf)

LoadModule rewrite_module modules/mod_rewrite.so

Include conf/extra/httpd-vhosts.conf

httpd-vhosts.conf中的NameVirtualHost的端口号要改过来,默认的不需要改(80),每个项目的路径

 <VirtualHost *:8084>

   DocumentRoot "d:/web/aod/htdocs"        

   ServerName environment                    

 </VirtualHost>

  修改httpd.conf中的

<Directory/>

Options FollowSymLinks

AllowOverride None

Order deny,allow

allow from all

</Directory>  

 

注意要改为allowfrom all

  下面三个注释掉可以运行:

 #ServerAdmin wad@lzb.ac.cn

 #ServerName wad:8081

 #DocumentRoot "D:/Program Files (x86)/Apache SoftwareFoundation/Apache2.2/htdocs"

  如果你的项目的路径在默认的Directory中定义,那么必须将这部分改为第6的设置,如果设置成下面这个样子会报错(出现错误:couldn't perform authentication. AuthType not set!: /index.php)。

新建Directory "C:/web/environment/htdocs">这样的目录的话,就要设置成第六那样。而默认的

<Directory "D:/Program Files (x86)/Apache SoftwareFoundation/Apache2.2/htdocs">

配置不用变。
 

<Directory "D:/Program Files (x86)/Apache SoftwareFoundation/Apache2.2/htdocs">

    #

    #Possible values for the Options directive are "None","All",

    #or any combination of:

   #   Indexes IncludesFollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    #Note that "MultiViews" must be named *explicitly* --- "OptionsAll"

    #doesn't give it to you.

    #

    #The Options directive is both complicated and important.  Please see

    #http://httpd.apache.org/docs/2.2/mod/core.html#options

    #for more information.

    #

  Options Indexes FollowSymLinks Includes ExecCGI


    #

    #AllowOverride controls what directives may be placed in .htaccess files.

    #It can be "All", "None", or any combination of thekeywords:

   #   AllowOverride FileInfoAuthConfig Limit

    #

   AllowOverride None


    #

    #Controls who can get stuff from this server.

    #

   Require all granted


</Directory>

httpd.conf中这个也需要改  添加index.php  不会出现文件列表了!

 <IfModule dir_module>

    DirectoryIndex  index.php  index.html

</IfModule>

5 在【环境变量】的【Path】中加入:

;E:\ProgramFiles\PHP; E:\Program Files\PHP\ext

两个值。这个必须有,要不然数据库驱动找不到!还要注意下phpinfo中显示的Configuration File (php.ini) Path :C:\Windows   要不php.ini复制到c下面,这个可能不需要。

 

6出现错误:couldn't performauthentication. AuthType not set!: /index.php修改

<Directory "C:/Program Files/Apache SoftwareFoundation/Apache2.2/htdocs">

    #

    #Possible values for the Options directive are "None","All",

    #or any combination of:

   #   Indexes IncludesFollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    #Note that "MultiViews" must be named *explicitly* --- "OptionsAll"

    #doesn't give it to you.

    #

    #The Options directive is both complicated and important.  Please see

    #http://httpd.apache.org/docs/2.2/mod/core.html#options

    #for more information.

    #

    Options Indexes FollowSymLinks


    #

    #AllowOverride controls what directives may be placed in .htaccess files.

    #It can be "All", "None", or any combination of thekeywords:

   #   Options FileInfo AuthConfigLimit

    #

   AllowOverride None


    #

    #Controls who can get stuff from this server.

    #

   Order allow,deny

   Allow from all

</Directory>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值