如何在Windows Server 2008 r2上为PHP CGI/FastCGI SAPI设置php.ini路径? [英] How to set the php.ini path for PHP CGI/FastCGI SAPI on Windows Server 2008 r2?
问题描述
我在Microsoft Windows Server 2008 Standard 6.0 SP2上具有IIS 7.0和两个版本的PHP v5
和v7
.问题是,PHP7或IIS尝试将PHP5的php.ini用于IIS网站".
I have IIS 7.0 and two versions PHP v5
and v7
on my Microsoft Windows Server 2008 Standard 6.0 SP2. The problem is, that PHP7 or IIS tries to use the php.ini of PHP5 for IIS "websites".
所以在命令行上一切都很好:
So on the command line everything is fine:
X:\>php -v
PHP 7.0.2 (cli) (built: Jan 6 2016 12:59:59) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
X:\>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: D:\Data\Programme\php7\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
但是在IIS管理器中,在phpinfo()
输出中不是:
But in the IIS Manager and in the phpinfo()
output not:
我认为,这是一个PHP(cgi-fcgi
SAPI)问题,不是一个IIS问题(但不确定).
I think, it's a PHP (cgi-fcgi
SAPI) issue, not an IIS issue (but not sure).
如何在Windows Server 2008上为PHP CGI/FastCGI SAPI设置正确的php.ini
?
How to set the correct php.ini
for PHP CGI/FastCGI SAPI on Windows Server 2008?
也通过注册表进行了尝试,但这没有帮助:
Also tried it over the Registry, but that didn't help:
推荐答案
The solution of Jan Reilink seems also correct, but unfortunately I could not find out, how to apply it the right way (see this and other my comments below Jan's answer).
最后,我通过IIS GUI解决了该问题:
Finally I got it solved over the IIS GUI:
然后是FastCGI Settings -> EnvironmentVariables -> PHPRC
:
另请参阅"配置IIS以处理PHP请求".
这篇关于如何在Windows Server 2008 r2上为PHP CGI/FastCGI SAPI设置php.ini路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!