There are three ways for PHP to work in Apache: CGI mode, Apache module DLL, FastCGI mode, and I. CGI mode: CGI mode in Apache2. Edit the Apache configuration file httpd. conf as follows: # ScriptAliasphpD in PHP4: php Apache
There are three ways for PHP to work in Apache: CGI mode, Apache module DLL, FastCGI mode,
I. CGI mode
CGI mode of PHP in Apache 2. Edit the Apache configuration file httpd. conf as follows:
# PHP4
ScriptAlias/php/"D:/php /"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php.exe"
# PHP5
ScriptAlias/php/"D:/php /"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php-cgi.exe"
II. Apache module mode
Module mode of PHP in Apache 2. Edit the Apache configuration file httpd. conf as follows:
# PHP4
LoadModule php4_module "D:/php/php4apache2. dll"
AddType application/x-httpd-php. php
# Do not forget to copy php4apache2. dll from the sapi directory!
# PHP5
LoadModule php5_module "D:/php/php5apache2. dll"
AddType application/x-httpd-php. php
PHPIniDir "D:/php"
# PHPIniDir is used to specify the php configuration file php. ini path
III. FastCGI mode
The FastCGI module under Apache currently has two versions on the Internet: mod_fastcgi and mod_fcgid. Mod_fcgid is recommended.
Use mod_fcgid to configure fastCGI mode
Download mod_fcgid and copy the "mod_fcgid.so" file in the compressed package to the "modules" directory of apache. Open the httpd. conf file of Apache and add the following configuration at the end:
LoadModule fcgid_module modules/mod_fcgid.so
AddHandler fcgid-script. fcgi. php # php. ini storage directory FcgidInitialEnv PHPRC "D:/PHP" # set PHP_FCGI_MAX_REQUESTS to be greater than or equal to FcgidMaxRequestsPerProcess, prevent the php-cgi process from exiting FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000 # maximum number of requests for each php-cgi process FcgidMaxRequestsPerProcess 1000 # maximum number of php-cgi processes FcgidMaxProcesses 5 # Maximum execution fcgidIOTimeout 120 FcgidIdleTimeout 120 # php-cgi path FcgidWrapper "D: /PHP/php-cgi.exe ". php AddType application/x-httpd-php. php
Modify the configuration of the DocumentRoot path:
Options Indexes FollowSymLinks ExecCGI Order allow,deny Allow from all AllowOverride All