More praise for Beyond Compare

The first time Jeff Atwood blogged about Beyond Compare, I tried it, didn’t like it, uninstalled it from my system and let it become a distant memory. But, pretty much everything Jeff talks about on his blog makes a helluva lotta sense, so the second mention tempted me to try it again and give it a chance to flourish. I’ve never looked back.

This is definitely one of those underrated tools, and really deserves more praise than it gets. I’ve been using it for a couple of months now, and it’s become an invaluable addition to my toolbox, especially in situations when deploying new code to webservers with content managed by Macromedia Contribute, or where SourceSafe wasn’t being used.

For $30 it’s a bargain, and highly recommended. Get it!

Downloading zip files from Windows 2003 Server and Internet Explorer

We had this very bizarre issue today, where attempting to download zip files from Windows 2003 Server. Using Firefox, the file could be opened successfully, but Internet Explorer displayed one of the following errors:

Internet Explorer cannot download [file] from [server]. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.

– or –

The Compressed (zipped) Folder is invalid or corrupted.

The zip file was definitely not corrupted. It could be opened using different zip applications, on different machines, over network shares, etc. Just not using Internet Explorer from the specified URL, though opening other zip files from other URL’s worked fine.

Both problems have some documentation on Microsoft’s support website:

* http://support.microsoft.com/?kbid=816868
* http://support.microsoft.com/?kbid=308090

Neither of these items present a solution that is satisfactory, as they require the user to make changes to their machine, either by installing an Internet Explorer Service Pack, or changing file options in Windows.

Some investigation revealed that the problematic files all resided on websites being hosted from our development server, which is running Windows 2003 Server. Putting the zip file on a Linux or Windows 2000 Server box allowed Internet Explorer to download it without any problems.

It all came down to how IIS6 deals with mime types it doesn’t know about. To tighten up security, Microsoft has designed IIS6 to not serve files of unknown mime types. Although Windows 2003 Server has built-in support for compressed files, and in this case, Winzip was also installed on the server, which registered the zip extension and mime type, IIS was still refusing to serve zip files.

The workaround involved going into IIS and manually adding the zip extension and its mime type, so that IIS recognises it, and hence, serves it to visitors. To do this, you need to follow these steps:

* Open up IIS
* Right click on the website, then Properties
* Click on the HTTP Headers tab
* Click on the Mime Types button at the bottom
* Click New
* In the extension box, enter .ZIP, and in MIME type: application/x-zip-compressed
* Press OK, OK, OK

Changes take effect immediately; you do not need to restart IIS. Voila, users can now download zip files.

Update: some further investigation has revealed that the above doesn’t always solve the problem, but it’s still worth trying anyway. The exact cause of this remains unknown. Another reason to use Firefox perhaps?

PHP 5.1.2, MySQL 5.0.18 and IIS woes

Installing PHP 5.1.2 and MySQL 5.0.18 on Windows Server 2003 was a complete nightmare. Although each one installed without any problems, for some odd reason, PHP refused to load the MySQL module, making it practically useless. There were no errors, nothing. No indication to show what was wrong. It appears that the problem was caused by quote marks around the extension_dir value in php.ini, which for some odd reason cause modules not to be loaded in the latest version of PHP (5.1.2) although it’s never been an issue in previous releases.

Rather annoyingly, there’s also two versions of the MySQL libraries floating around. The PHP installer has one version, and there’s a newer version on the MySQL website which they recommend downloading and using.

Steps I took to get things working:

Things to download:

- PHP 5.1.2 installer
- PHP 5.1.2 zip package
- MySQL 5.0.10 Windows Installer
- MySQL 5.0.18 connectors (both MySQL and MySQLi).

First install MySQL 5.0 by running the installer. Once completed, go through the server configuration wizard to configure things. Nothing complicated here.

Next, install PHP by running the installer. You should install to C:\PHP (to keep things easy). Press yes when prompted to set-up IIS with the correct script mappings. Once that’s done, unzip the PHP zip package over C:\PHP. This is because the Windows installer doesn’t include any of the additional modules (but the zip file does).

After that, unzip the MySQL connectors. Copy the php_mysql.dll and php_mysqli.dll files to C:\PHP\ext and the lib*.dll files to C:\PHP.

Edit C:\Windows\PHP.ini. Look for the line starting with extension_dir and make sure that the line reads extension_dir = C:\PHP\ext – without quotes. Scroll down and remove the semicolon from the start of the line extension=php_mysql.dll and also from extension=php_mysqli.dll.

Now restart IIS. A quick way to do this is typing iisreset from the command prompt.

If you didn’t set up the script mappings in IIS as part of the PHP installation, you will need to do these manually. The PHP extension must be mapped to php5isapi.dll. If using Windows 2003 Server, make sure you also set up PHP in IIS Web Service Extensions and set its status to allowed.

Once everything is done, check that PHP and MySQL are working by creating a PHP file which calls phpinfo() and accessing this file through your web browser. You should have the mysql and mysqli settings listed between the libxml and odbc settings.

Hope this helps someone out there! :-)

Updated on 07 February 2006, recommending use of php5isapi.dll instead of php-cgi.exe, as this is designed for IIS and offers better performance..