views:

320

answers:

4

I'm running PHP 5.2.8 on Apache 2.2.11 on Windows XP SP 3. In php.ini,

extension_dir = "C:\Program Files\PHP\ext"
extension=php_mysql.dll

In error.log:

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0

php_mysql.dll is definately located in the extension_dir, and is the version that PHP 5.2.8 is bundled with. What's up?

+1  A: 

You could try

extension_dir = "C:/Program Files/PHP/ext"

Edit: No, not that. Seems you need to add it to the PATH variable in Windows: http://us2.php.net/manual/en/install.windows.iis.php

Erik
The OP is using Apache, not IIS.
Ross
+2  A: 

Try adding a trailing slash to your extension_dir path.

This is what I am using in my WAMP setup:

extension_dir = "D:\php\ext\"
; ...snip...
extension=php_gd2.dll
Ross
+1  A: 

You need to make the MySQL client library available to PHP. This is done by copying the libmysql.dll file from the PHP package root directory into a directory on your system within the Windows PATH.

The quickest way to do this is to copy libmysql.dll into your C:\Windows\System directory but as noted in the manual, this is not recommended and is just a quick fix to see if it is actually the problem here.

http://us2.php.net/manual/en/mysql.installation.php says:

MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.

The best option is to add the PHP directory into your Windows PATH, which is explained in this FAQ.

DavidM
A: 

Thank you all for answering. Your input was great but what ultimately fixed the problem was adding the trailing slash to extension_dir.

orlandu63