如何设置php.ini的位置? [英] How to set php.ini location?
问题描述
我刚刚安装了PHP,Apache和MySQL,对配置文件进行了一些更改,并且可以运行,但是phpinfo()表示它将在C:\ Windows中查找php.ini. 如何使它看起来在其他地方?我应该在Apache中配置它吗?我把:
I just installed PHP, Apache and MySQL, did some changes to the configuration files and it works but phpinfo() says it looks for php.ini in C:\Windows. How to make it look somewhere else? Should I configure this in Apache? I put:
SetEnv PHPRC "C:/wamp/php5.6.5"
在http.conf中,重新命名为Apache,但没有帮助.我知道WampServer之类的程序使用phpForApache.ini而不是php.ini,但我不知道它们是如何做到的.
in http.conf, restared Apache but it didn't help. I know that programs like WampServer use phpForApache.ini instead of php.ini but I don't know how they do this.
推荐答案
从PHP 5.2.0开始,可以为不同版本的PHP设置php.ini文件的位置.依次检查以下注册表项:[HKEY_LOCAL_MACHINE \ SOFTWARE \ PHP \ xyz],[HKEY_LOCAL_MACHINE \ SOFTWARE \ PHP \ xy]和[HKEY_LOCAL_MACHINE \ SOFTWARE \ PHP \ x],其中x,y和z表示PHP专业语言,次要版本和发行版本.如果这些键中的任何一个都有IniFilePath的值,则找到的第一个键将用作php.ini的位置(仅Windows).
As of PHP 5.2.0, the location of the php.ini file can be set for different versions of PHP. The following registry keys are examined in order: [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z], [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y] and [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x], where x, y and z mean the PHP major, minor and release versions. If there is a value for IniFilePath in any of these keys, the first one found will be used as the location of the php.ini (Windows only).
这篇关于如何设置php.ini的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!