Page 1 of 1
Change PHP.ini directory in Windows
Posted: Wed Dec 08, 2004 6:57 am
by flanakin
I'm working with PHP for the first time and I used the Windows installer. Later, I realized that this probably wasn't the best idea, so I uninstalled and setup PHP from the binaries. I found out that PHP is looking for the PHP.ini file in the c:\Windows directory instead of c:\PHP. Is there any way I can change this? I tried searching thru the registry, but didn't see anything. Any help is appreciated. Thanks!
Posted: Wed Dec 08, 2004 8:11 am
by Maugrim_The_Reaper
PHP Installer is complete rubbish - glad to see you noticed...
You should place php.ini into your windows or winnt directory. This directory is usually on your systems PATH, i.e. the list of location all application will search for their DLLs and other files.
It should also work if in the same directory as the PHP binary executable - but that's not usually the best idea. If you really want to be certain c:\php is searched, then add that to your PATH - i.e. right click My Computer -> Properties -> Advanced -> Environment Variables. In User Variable (top section) locate the variable Path. Edit this, and add your c:\php to the list. Entries are separated by a semi-colon ; I believe.
Posted: Wed Dec 08, 2004 8:36 am
by flanakin
Yeah, c:\PHP is in my PATH environment variable. All that's good. I would just rather have the php.ini file in the c:\PHP directory for upgrade purposes. I'd like to keep it all in the same place, if possible. Do you think this is a bad idea? The only reason I'd think that it was bad would be because the old ini file might get overwritten when deploying a new version of PHP. This is something that must be handled, anyway (i.e. for extensions).
Posted: Wed Dec 08, 2004 9:09 am
by Maugrim_The_Reaper
Can't see any reason why it would not grab from that location. If it's in the path, and it contains php.ini - and assuming there are no php.ini files anywhere else in path - it should work.
What's the exact error message being received by chance? Should also appear in your apache logs presumably at startup.
Posted: Wed Dec 08, 2004 9:15 am
by flanakin
There is no error. I ran [php_man]php_info[/php_man]() and saw that the config file path was set to C:\Windows\php.ini. Everything works fine with it in that directory, I would just rather have it in the C:\PHP directory. Well, unless there is some obviously blatant reason that would make being in the Windows directory better.