I have installed php successfully on a Windows 7 machine but I can not for the life of me get it to read the php.ini file.
I have uncommented out the line for php to use mysql and when I run phpinfo(), it never shows up.
I have checked to make sure there is only one php.ini file on my entire c:\ drive and it’s sitting in my c:\windows folder.
has anyone else run into this and know of a solution to get php to read the .ini so that I can enable some extensions (mysql etc)?
Check the following:
Make sure you only have one
php.inifile. It should be in the same folder asphp.exe,php-cgi.exeandphp-win.exe. It’s worth checking yourc:\windowsandc:\windows\system32folders. If you find aphp.iniin there or anywhere else on thePATHother than the PHP install folder then delete them.A handy way to check this is to run
where php.inifrom the command prompt.Add your PHP install and extensions folders to the system
PATH: For example –c:\phpandc:\php\extEdit your
php.inifile and ensure that theextension_dirdirective points to the extensions folder:extension_dir=c:\php\extThis should get you going. If you still find that extensions aren’t being loaded then prepend the extension with
ext/. For example:extension=ext/php_mysql.dllYou don’t indicate if you’re using FastCGI to launch PHP.
If you’re just mapping the
.phpextension directly tophp-cgi.exeor you’re using FastCGI but haven’t specified amonitorChangesToattribute then you need to kill anyphp-cgi.exeprocesses to force a re-read ofphp.iniafter any changes (or do anIISRESET).If you’re using FastCGI on Windows 7 (or IIS 7.5 generally) then you can trigger recycling of FastCGI whenever your
php.inifile changes by specifying a the path to thephp.inifile in themonitorChangesToattribute. This is also configurable through IIS Manager under the FastCGI Settings applet.