views:

246

answers:

1

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

+2  A: 

Check the following:

  1. Make sure you only have one php.ini file. It should be in the same folder as php.exe, php-cgi.exe and php-win.exe. It's worth checking your c:\windows and c:\windows\system32 folders. If you find a php.ini in there or anywhere else on the PATH other than the PHP install folder then delete them.

    A handy way to check this is to run where php.ini from the command prompt.

  2. Add your PHP install and extensions folders to the system PATH: For example - c:\php and c:\php\ext

  3. Edit your php.ini file and ensure that the extension_dir directive points to the extensions folder: extension_dir=c:\php\ext

This 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.dll

You don't indicate if you're using FastCGI to launch PHP.

If you're just mapping the .php extension directly to php-cgi.exe or you're using FastCGI but haven't specified a monitorChangesTo attribute then you need to kill any php-cgi.exe processes to force a re-read of php.ini after any changes (or do an IISRESET).

If you're using FastCGI on Windows 7 (or IIS 7.5 generally) then you can trigger recycling of FastCGI whenever your php.ini file changes by specifying a the path to the php.ini file in the monitorChangesTo attribute. This is also configurable through IIS Manager under the FastCGI Settings applet.

Kev