WIMP on Windows 7 – Windows, IIS, MySQL and PHP

In the past it was always a bit challenging to get WIMP installed, at least for me it was. I ended up using installers for PHP and even then which version would I use, fast cgi or that other one (can’t seem to remember the name, it’s been a while). Recently, I had to create an environment that uses WIMP. I had to take old data from MSSQL 2008 and convert it over to MySQL. I tried to use MySQL Workbench’s migration tool but it failed on 5 of the tables. So my plan is to use PHP and somehow import the data over. Well I would need to use SQLSRV driver for PHP5 to connect to MSSQL 2008. Enough of the back story, here’s what I did.

First off, I am using Windows 7 Professional 64bit. You will need to enable IIS in the Control Panel by turning it on in the Windows features. Here’s what mine looks like.


You don’t need all of the checked features but you will need CGI under Application Development Features – this is how PHP will run within IIS. Leave the others default. Once installed, there may be new Windows updates related to what you just enabled. It’s a good idea to patch them up. The version of IIS I’m running during time of writing is 7.5. Screenshots and feature location may differ from your version.

Now download PHP5 the version you wish to use from http://windows.php.net/download. What I downloaded and used was 5.4.27. I needed a version from 5.4 because of the SQLSVR I mentioned earlier. I haven’t tested to see if the driver works on PHP5.5+. Also, you want to download the NTS (non-thread safe) version. In my case, it’s VC9 NTS for PHP5.4.27. Unzip the file and put it in C:PHP5. You can put it anywhere but I just wanted it more accessible.

Inside this folder, look for a file called php.ini-development. Copy and rename the file to php.ini. I chose development because my environment is for development only. There is a production version with slightly different settings.

Here are the entries that need modification within the php.ini files.

  • extension_dir = “ext” (enable this if you’re going to use extensions)
  • fastcgi.impersonate = 1 (enable this)
  • cgi.fix_pathinfo=1 (enable this)
  • cgi.force_redirect = 1 (enable this)

Save the file and close it.

Now we need to let IIS know how to serve PHP pages. Open up IIS Manager. Highlight the entire Server to apply to all websites hosted or specific ones – in this case, highlight Default Web Site. Next, double-click on Handler Mappings and Add Module Mappings. Here’s how mine looks.


Restart IIS. Create a test file using phpinfo(). You should see something like this if all is in working order.


To install MySQL, just download an installer from http://dev.mysql.com/downloads/windows/installer. The great thing about the installer is that it comes with other goodies such as MySQL Workbench and connectors such as ODBC (which I needed to get the migration tool from Workbench to connect to MSSQL server). If you are going to use MySQL, don’t forget to enable the extension(s) in the php.ini file. You can find more detailed instructions from http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis.

ASO and MySQL Workbench error

I recently switched over to A Small Orange as a host provider and have been happy with their services so far. My websites are running faster than they did before. But now I run into a small issue. I use MySQL Workbenchto work on databases. It’s a great software. But I get an error when I try to connect to a database remotely.


I did a few searches and found a post regarding the skip-networking entry in the config file. Unfortunately, I’m in a shared environment and do not have access to that file. I have contacted the ASO tech support. Hope they can find a solution. I never had this issue with other host provider.

Django and MySQL problems

I’ve been checking out Python and Django and I’m impressed at what it can do. It’s efficient and has more things built-in compared to PHP and CodeIgniter. Unfortunately, I ran into some issues when installing the python-mysqldb. Without it, I can’t connect to MySQL – I could do sqlite3 fine though. I have existing projects running MySQL database so I’d like to stay with it.

I’ve spent a few days and I just can’t get it installed. I keep getting “No module named MySQLdb” errors and “ConfigParser.NoSectionError: No section: ‘metadata’” errors. I give up haha. I was hoping for a fast deployment of a development environment but ended up spending more time than I wanted to. It’s too bad since I was starting to like it – again it works fine with sqlite3 and I was enjoying it.

I guess I’m going to leave it alone for a while until more people get the error and share they’re solutions. I’ve searched online and was unable to find an answer. I’m going to check out Ruby on Rails again. There’s an interesting installer now at RailsInstaller.

Debian5 Lenny and MySQL Server 5.1.x

I am running Debian5 Lenny which is running Virtualmin and Webmin. The default configurations install MySQL server 5.0.51. MySQL’s website has version 5.1.x. I wanted to update the version on my Debian box. Unfortunately, Debian considers MySQL 5.0.51 as the stable version, while version 5.1.49 is considered unstable. You can install it by updating your /etc/apt/sources.list file. Add the following lines and save.

deb http://ftp.de.debian.org/debian/ sid main
deb-src http://ftp.de.debian.org/debian/ sid main

After saving the file, update the apt-get.

apt-get update

You can continue to use apt-get and install the newer version of MySQL server or use the Webmin web gui. You can search for it under System/Software Packages, then search for “mysql-server”. You will see the newer version. Before you install it, make sure you have backed up your database, it will remove the old one.

It took some time to find the information. I had to browse different websites and piece together the information. It’s funny how something this common, is hard to find a solution to on one web page. I hope this helps Linux noobs like me out there. Do keep in mind that Debian considers this version of MySQL unstable.

Allowing network connections to MySQL in OS X Leopard Server

For the past couple of days I’ve been trying to set up one of our XServe running Leopard Server at work for web hosting. I was able to configure the Web, AFP, and SMB properly. The problem I was having was configuring MySQL. It was easy to enable but trying to connect to it from other computers in the same domain was the problem. There’s a checkbox with “Allow network connections” in the Server Admin section of MySQL. So I checked it, save, and restarted it. I still wasn’t able to connect. I checked for firewall settings. I pinged the host and got a response. I couldn’t figure out what was wrong. So I googled it.

The common answer I found was to edit the /etc/mysql/my.cnf file. Well it’s not there but I did find a /etc/my.cnf file. So I tried editing that file and restarting. It didn’t work.

Then I remembered that the php.ini file that Leopard Server is using isn’t in the default location /etc/php.ini, but it ran the /private/etc/php.ini. So I looked in there and found another my.cnf file. I edited the file by adding # in front of skip-networking entry. I restarted it and it finally worked.

So here’s what you need to do:

  • Go into Server Admin and check the Allow network connections and save
  • Comment out the skip-networking entry from /private/etc/my.cnf
  • Add the IP address of the computer you will be accessing MySQL remotely
  • Give it the privileges it needs
  • Restart MySQL

That should allow you to connect to MySQL running on Leopard Server remotely.

MySQL backup and restore databases with views

We recently installed OS X Leopard Server at work. I had to take MySQL databases from our old Tiger Server and restore them onto the new XServes. Both servers are running MySQL Server version 5.0.45 but our Tiger server is running MySQL Client version 5.0.22 while our Leopard servers are running MySQL Client version 5.1.18. According to MySQL’s documentation (http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html):

Prior to release 5.0.48, this option did not create valid SQL if the database dump contained views. The recreation of views requires the creation and removal of temporary tables and this option suppressed the removal of those temporary tables. As a workaround, use –compress with the –add-drop-table option and then manually adjust the dump file.

I tried the –compress option but it didn’t work. I still had to manually adjust the SQL file. The I tried the GUI tool from MySQL, http://dev.mysql.com/downloads/gui-tools/5.0.html (MySQL Administrator).

mysql admin

Once you create the backup, you can restore it using the same application on the newer server. It will even include the views. Once you start using the newer client, you shouldn’t have a problem restoring databases with views from backups made with the mysqldump command.