twn39 / code

:memo: 代码笔记,通过 issue 的方式记录日常遇到的问题和学习笔记
13 stars 1 forks source link

Windows配置Apache和PHP7 #141

Open twn39 opened 7 years ago

twn39 commented 7 years ago

Windows配置Apache和PHP7

twn39 commented 7 years ago

下载apache最新版:http://www.apachelounge.com/download/

编辑http.conf:

加载php模块

PHPIniDir "D:/php7/"
LoadModule php7_module "D:/php7/php7apache2_4.dll"

修改索引文件

<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

添加php文件类型

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
twn39 commented 7 years ago

注:启用proxy_http_module会出现问题

twn39 commented 7 years ago

启用vhost:

Include conf/extra/httpd-vhosts.conf
twn39 commented 7 years ago

安装:

Install
-------

- Unzip the Apache24 folder to c:/Apache24 (that is the ServerRoot in the config).
  Default folder for your your webpages is DocumentRoot "c:/Apache24/htdocs"

  When you unzip to an other location, change ServerRoot in the httpd.conf,
  and change in httpd.conf the Documenroot, Directories, ScriptAlias,
  also when you use the extra folder config file(s) change to your location there. 

Start apache in a DOS box:

>httpd.exe

Install as a service:

>httpd.exe -k install

ApacheMonitor:

Double click ApacheMonitor.exe, or put it in your Startup folder.