First, the CGI mode
PHP in Apache 2 in CGI mode. Edit the Apache configuration file httpd.conf as follows:
# PHP4 Version
scriptalias/php/"d:/php/"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php.exe"
# PHP5 Version
scriptalias/php/"d:/php/"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php-cgi.exe"
Second, Apache module mode
PHP module mode in Apache 2. Edit the Apache configuration file httpd.conf as follows:
# PHP4 Version
LoadModule php4_module "D:/php/php4apache2.dll"
AddType application/x-httpd-php. php
# Don't forget to copy the Php4apache2.dll from the SAPI directory!
# PHP5 Version
LoadModule php5_module "D:/php/php5apache2.dll"
AddType application/x-httpd-php. php
Phpinidir "d:/php"
# Phpinidir is the path used to indicate the PHP configuration file php.ini
Three, fastcgi mode
The FASTCGI module under Apache currently has two versions of mod_fastcgi and Mod_fcgid online. Recommended for Mod_fcgid.
Configuring fastcgi mode with Mod_fcgid
Download the mod_fcgid and copy the "mod_fcgid.so" file in the archive to Apache's "modules" directory. Open the Apache httpd.conf file and add the following configuration at the end:
LoadModule fcgid_module modules/mod_fcgid.so<ifmodule mod_fcgid.c> AddHandler fcgid-script. fcgi. PHP #php. ini storage directory fcgidinitialenv PHPRC "d:/php" # set php_fcgi_max_requests greater than or equal to fcgidmaxrequestsperprocess, Prevents the php-cgi process from exiting fcgidinitialenv php_fcgi_max_requests #php-cgi The maximum number of requests per process before processing all requests Fcgidmaxrequestsperprocess #php-cgi Maximum number of processes fcgidmaxprocesses 5 #最大执行时间 fcgidiotimeout 120 fcgididletimeout #php-cgi path fcgidwrapper "D:/php/php-cgi.exe". PHP AddType application/ x-httpd-php .php</ifmodule>
Modify the configuration of the DocumentRoot path to:
<directory "D:/www" > Options Indexes followsymlinks execcgi Order allow,deny allowoverride all</directory>