php_mysqli.dll is not a valid Win32 Application

I’ve installed and configured Apache, PHP and MySQL per the “Windows Installation>Installing Individual Packages” section in “Build Your Own Database Driven Website Using PHP & MySQL, 4th Edition by Kevin Yank” and I’m getting an error in the Apache logs.

First, config deets:

-Windows 7 Home Premium (64-bit)
-Apache 2.2
-PHP 5.2.13 Win32
-MySQL 5.1.46

I’ve tried all the typical recommended fixes, like these:

http://www.datavish.com/2009/11/your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-required-by-wordpress/

(I know the above recommendations are IIS-specific, but I translated them to Apache lingo for my purposes)

Here’s the error message I’m getting in Apache’s error.log:

PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\\PHP\\ext\\php_mysqli.dll’ - %1 is not a valid Win32 application.\r
in Unknown on line 0

I have a feeling this has to do with the Windows & PHP versions I’m using, but I did not find anything regarding this specific setup in the book.

I also previously tried installing WampServer2i, and that crashed while attempting to launch, so I ended up uninstalling and attempting the manual route.

Any recommendations are greatly appreciated.

I found a RESOLVED thread at PHPBuilder PHP Forum. Hope this will help you.

Raju, I had actually already found that thread and tried most of the suggestions in it, outside of downloading a new version of PHP or restarting my system. I didn’t think that either of these steps should be required, but unless I find a better solution here, I’ll have to take these next steps.

I’ve resolved this, and it took a perfect blend of app versions to get AMP running in Windows 7. Here’s what I ended up finding out:

-Apache & PHP only provide 32-bit versions
-MySQL is available as 64-bit, and MUST be installed as 64-bit. 32-bit MySQL did not work for me on Win 7 64-bit.
-PHP 5.3 must be used. PHP 5.2.x had some type of conflict for me.

It was ultimately the upgrade of PHP from 5.2 to 5.3 that fixed this issue for me. Required reading for anyone installing PHP on Windows:

http://www.php.net/manual/en/install.windows.manual.php