phpstudy php+apache 环境PHP多版本环境配置

1,编辑httpd.conf

LoadModule fcgid_module modules/mod_fcgid.so

#添加映射
AddHandler fcgid-script .fcgi .php
# 设置PHP_FCGI_MAX_REQUESTS大于或等于FcgidMaxRequestsPerProcess,防止php-cgi进程在处理完所有请求前退出
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
#php-cgi每个进程的最大请求数
FcgidMaxRequestsPerProcess 1000
#php-cgi最大的进程数
FcgidMaxProcesses 3
#最大执行时间
FcgidIOTimeout 120
FcgidIdleTimeout 120

AddType application/x-httpd-php .php .phtml    #表示允许处理的文件类型
#------这里是默认虚拟主机配置
#php.ini的存放目录
FcgidInitialEnv PHPRC "D:/phpStudy/PHPTutorial/php/php-7.0.12-nts"

2,编辑vhosts.conf不同域名使用不同php版本处理

<VirtualHost *:80>
DocumentRoot "D:/www"
	
ServerName ***

#------这里是默认虚拟主机配置
#php.ini的存放目录
FcgidInitialEnv PHPRC "D:/phpStudy/PHPTutorial/php/php-5.4.45-nts"
AddHandler fcgid-script .php
#php-cgi的路径
FcgidWrapper "D:/phpStudy/PHPTutorial/php/php-5.4.45-nts/php-cgi.exe" .php

ErrorLog "D:\logs\web\720.qhxkj.com-error.log"
CustomLog "D:\logs\web\720.qhxkj.com-access.log" common
<Directory "D:/www/">
Require all granted
Options Indexes FollowSymLinks ExecCGI
</Directory>
</VirtualHost>

协议为https时需要把配置写入httpd-ssl.conf,否则无效, 注意options选项,缺少ExecCGI会出现 访问php文件出现403无权访问现象

3,重启服务完成

猜你喜欢

转载自blog.csdn.net/guoguicheng1314/article/details/80882488
今日推荐