Search code examples
phpmysqlwindows-vista64-bit

Can't get PHP to work with MySQL on Vista 64


I'm running Vista 64 box, and attempting to setup Joomla using IIS7 (I like Joomla, I want to have some asp.net components on my web site, so that's why I want to use IIS7 and not Apache). It's my first time installing both PHP and MySQL, so it's very possible that I'm doing something obviously wrong... though I think I tried enough diagnostic steps (described below) that there's nothing obviously wrong to me...

I installed PHP (32 bit, 5.2.8), and that seems to work OK: I got a test.php that displays phpinfo in an IIS7-served web page.

I also installed MySQL (32 bit, 5.1.31, downloaded from http://dev.mysql.com/downloads/mysql/5.1.html#win32 ). That seems to work fine too (I can connect to it using MySQL Administrator).

I've setup php.ini and what not to turn on the MySQL extension. If I do PHP -m from the command line I see MySQL in the list. However, with phpinfo (either from the command line (PHP -info) or served via IIS (in a test.php file)), there is no MySQL section. Because MySQL is not even showing up in the command-line call of PHP, I don't think this has anything to do with IIS -- just an install of MySQL & PHP on vista.

I didn't install MySQL 64bit because I have an 32bit install of PHP, and since MySQL 32 bit seems to work fine I assume that's not the issue. It seems there is no official 64bit version of PHP so that's why I installed that (and again, that seems to work fine).

I currently have UAC disabled, so that's not the issue.

If I put the semi-colon back in front of extension=php_mysql.dll in my php.ini then when running PHP -m, the MySQL module doesn't show up. If I take it out again then it shows up. So I'm at least certain I'm modifying the right php.ini.

I've copied libeay32.dll, libmysql.dll, and php_mysql.dll to c:\windows\system32. I've taken them out and that doesn't seem to make a difference to the output of PHP -m (i.e., MySQL still shows up there if the module is uncommented from php.ini).

I also tried copying the DLLs ibeay32.dll, libmysql.dll, and php_mysql.dll to c:\windows\sysWOW64; that made no difference.

It seems like the smallest positive step would be for MySQL to show up when running PHP -info from the command line. Is there any further thing I should try to figure out why MySQL is showing up in PHP -m and not with PHP -info? Or am I off track as using this to gauge whether PHP can talk to MySQL?


Solution

  • I've solved most of it.

    The answer was to copy libmysql.dll to sysWOW64. The other DLLs are not needed, and nothing needs to be copied to system32. I guess this is a result of using php32 on a 64 bit system.

    I thought that didn't work at first because running PHP -info from the command line still doesn't show MySQL. However, running phpinfo from a PHP file served by IIS does show MySQL.

    I still don't know why MySQL doesn't show up when running PHP -info from the command line, but I guess I can live with this for now.