search
Homephp教程php手册配置apache以支持php 在apache主配置文件httpd.conf中Include自

在apache的主配置文件/conf/http.conf 最下面添加 Include D:\workspace_php\apache-php.conf #文件路径可以任意 在D:\workspace_php文件下创建 apache-php.conf文件 它的具体内容为 ## PHP-Module setup#LoadFile D:/xampp/php/php5ts.dllLoadModule php5_m

在apache的主配置文件/conf/http.conf

最下面添加

Include "D:\workspace_php\apache-php.conf"

#文件路径可以任意

在D:\workspace_php文件下创建

apache-php.conf文件

它的具体内容为

#
# PHP-Module setup
#
LoadFile "D:/xampp/php/php5ts.dll"
LoadModule php5_module "D:/xampp/php/php5apache2_2.dll"

<filesmatch>
    SetHandler application/x-httpd-php
</filesmatch>
<filesmatch>
    SetHandler application/x-httpd-php-source
</filesmatch>

#
# PHP-CGI setup
#
#<filesmatch>
#    SetHandler application/x-httpd-php-cgi
#</filesmatch>
#<ifmodule actions_module>
#    Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
#</ifmodule>


<ifmodule php5_module>
    PHPINIDir "D:/xampp/php"
</ifmodule>

<ifmodule mime_module>
    AddType text/html .php .phps
</ifmodule>

ScriptAlias /php-cgi/ "D:/xampp/php/"
<directory>
    AllowOverride None
    Options None
    Require all denied
    <files>
          Require all granted
    </files>
</directory>

<directory>
    <filesmatch>
        SetHandler cgi-script
    </filesmatch>
    <filesmatch>
        SetHandler None
    </filesmatch>
</directory>


其中php所在的目录请根据自己的情况进行修改。

你可能已经注意到我用的是xampp下php。

本文也是借鉴了xampp的配置思路,即在apache主配置文件中多使用Include指令来添加自定义的配置文件,

尽可能减少对主配置文件的修改,使配置过程更加模块化。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft