MySQL on Windows 7 64 bit – Installation with Apache and PHP

MySQL on Windows 7 64 bit – Installation with Apache and PHP cover image
  1. Home
  2. Web Development
  3. MySQL on Windows 7 64 bit – Installation with Apache and PHP

A week back I got a spanking new Sony Vaio laptop running Windows 7 (64 bit). Its been a sort of tradition with me that the first programs I install on a new computer are Apache web server with PHP and MySQL. I do this even before I setup the email client.

I have been installing and using Apache+PHP+MySQL on Windows operating system since the late 90s, so I suppose I have been around. But there was something new to learn this time. This was a 64 bit computer running Windows 7. Nothing unusual I thought… but was I wrong!

Sponsored Links

Apache and PHP are available only in 32 bit versions. MySQL, on the other hand, is offered in both 32 bit and 64 bit. For the sake of coherency and consistency, I though I’ll install only the 32 bit versions of the three programs.

So was I successful? Oh Yes! But there was one big problem and here is the full story.

Installing MySQL 32 bit on Windows 7 64 bit computer

Following is the list of files I installed – you can get them from the download pages of, and

I installed Apache in C:/Apache and uncompressed PHP to C:/PHP. I then changed the httpd.conf file so that the web server knew where the PHP program was. I also made a few other minor changes.

The final step was installing MySQL and configuring an instance. This was a fairly straightforward process. I checked the MySQL command line editor and everything worked wonderfully.

It was now time to change the php.ini file so that it loaded the MySQL extension. Again, there were no problems and the phpinfo(); file showed that MySQL was being recognized. Great! I thought I was all set…

phpinfo() file shows that mysql and mysqli extensions have been loaded on Windows 7 64 bit system using MySQL server 32 bit

As shown by the screenshot of the phpinfo(); file, everything seems to be working without problems. But when I tried to connect to MySQL with the mysql_connect(), I got a web page not available message.
Web page not available? Was this a browser problem or an Apache problem? I was completely confounded.

With meticulous troubleshooting I came up with the following conclusions:

Conclusion: It was a MySQL 32 bit vs MySQL 64 bit issue. Though, the 32 bit software can be installed on Windows 7 and it will work without problems, PHP simply will not connect to it. You need to install the 64 bit version of MySQL on the Windows 7 64 bit operating system.

Please check out the step by step instructions with screenshots on how to install MySQL on Windows 7. You may also be interested on getting Apache web server and PHP to work on Windows 7 too!

Web Development