Configure Apache to support PHP in the Apache main configuration file httpd.conf Include custom profile in


In Apache’s main configuration file / conf/ http.conf

Add at the bottom

Include “D:workspace_phpapache-php.conf”

The file path can be any

In D: workspace_ Create under PHP file

apache- php.conf file

Its specific content is

[html] view plain copy

PHP-Module setup

LoadFile “D:/xampp/php/php5ts.dll”
LoadModule php5_module “D:/xampp/php/php5apache2_2.dll”

<FilesMatch “.php$”>

SetHandler application/x-httpd-php  

<FilesMatch “.phps$”>

SetHandler application/x-httpd-php-source  


PHP-CGI setup

<FilesMatch “.php$”>

SetHandler application/x-httpd-php-cgi


<IfModule actions_module>

Action application/x-httpd-php-cgi “/php-cgi/php-cgi.exe”


<IfModule php5_module>

PHPINIDir "D:/xampp/php"  


<IfModule mime_module>

AddType text/html .php .phps  


ScriptAlias /php-cgi/ “D:/xampp/php/”
<Directory “D:/xampp/php”>

AllowOverride None  
Options None  
Require all denied  
<Files "php-cgi.exe">  
      Require all granted  


<Directory “D:/xampp/cgi-bin”>

<FilesMatch "\.php$">  
    SetHandler cgi-script  
<FilesMatch "\.phps$">  
    SetHandler None  


Please modify the directory where PHP is located according to your own situation.
You may have noticed that I use PHP under xampp.

This paper also uses the configuration idea of xampp for reference, that is, in the main Apache configuration file, the include instruction is often used to add a custom configuration file,

Reduce the modification of the main configuration file as much as possible to make the configuration process more modular.