How to set php.ini location?

偶尔善良 提交于 2019-12-01 13:29:11

问题


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"

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.


回答1:


Taken word for word from the docs...

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).



来源:https://stackoverflow.com/questions/28351548/how-to-set-php-ini-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!