I've downloaded php, addeded it to my path and im trying to enabled openssl

php --ini tells me that configuration file is c:\windows which there was nothing there, I dont want to copy php into c/windows.

How do I change this to point at my php folder?


You do not need to put anthing to do with PHP anywhere near the c:\windows folder.

If you do it will only serve to mess you up when you upgrade PHP to a new version.

If you CD to the folder that PHP is installed in and do a php --ini it will read the php.ini file from the folder that you are in.

D:\wamp\bin\php\php5.5.12>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         D:\wamp\bin\php\php5.5.12\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

I think its also a bad idea to put the PHP install folder in the windows PATH as well.

All you need is a little batch file that will setup your PATH for the duration of the command window you are using, and put that in one of the folders that is already in the windows PATH.

So assuming you installed PHP into C:\php this is the batch file


php --ini
php -v

And you then just run this batch file any time you open a command windows and want to run some PHP code and your environment gets configured. You can also add other things to this batch file when you need other things added to your environment like Composer etc.

  • Yes! This works for me. PHP.ini is better with PHP.exe in same folder so that Web and CLI PHP can refer to same PHP.ini. – Scott Chu Dec 28 '15 at 6:37
  • @ScottChu Not really, they are 2 different environment and in real life you often want different configs for both. – RiggsFolly May 26 '16 at 12:25

According to documentation:

The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI and CLI versions, it happens on every invocation.

php.ini is searched for in these locations (in order):

  • SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
  • The PHPRC environment variable. Before PHP 5.2.0, this was checked after the registry key mentioned below.
  • 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).
  • [HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows only).
  • Current working directory (except CLI).
  • The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows).
  • Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option.

You should try either the PHPRC environment variable or registry key [HKEY_LOCAL_MACHINE\SOFTWARE\PHP].


I tried everything without success. changed the apache httpd.conf, php.ini and several other attempts, always resulted in Loaded Configuration File - (none). Finally, I copied all the files from the php directory to the directory C: \ Program Files (x86) \ Apache Software Foundation \ Apache2.2 \ bin and everything started to work. Perfectly. Unfortunately it is not the perfect solution, but it worked.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.