在Apache的配置文件httpd.conf下添加下面几个配置
LoadModule fcgid_module modules/mod_fcgid.so
AddHandler fcgid-script .fcgi .php
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
FcgidMaxRequestsPerProcess 1000
FcgidMaxProcesses 15
FcgidIOTimeout 120
FcgidIdleTimeout 120
AddType application/x-httpd-php .php
# 全局默认使用的PHP版本配置
FcgidInitialEnv PHPRC "D:/phpstudy/PHPTutorial/php/php-7.0.12-nts"
FcgidWrapper "D:/phpstudy/PHPTutorial/php/php-7.0.12-nts/php-cgi.exe" .php
然后在每个项目下配置你想使用的php版本就行了。
例:
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\php56"
ServerName localhost
ServerAlias
FcgidInitialEnv PHPRC "D:/phpStudy/php56n/"
FcgidWrapper "D:/phpStudy/php56n/php-cgi.exe" .php
<Directory "D:\phpStudy\WWW\php56">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>