Sunday, November 21, 2010

PHP on IIS7 on Windows 7 Home Premium

As a follow-up on my previous post, here's how to set up PHP 5.3.3 VC9 (MSI) on your newly enabled IIS7 on Windows 7 Home Premium

(The reason I'm emphasizing on Windows 7 Home Premium is because the Windows 7 Ultimate machine I have at work doesn't seem to have these kinds of problems)

Now if you run setup normally, you'd run into some weird error after selecting IIS FastCGI
Cancel PHP's setup and go back to

Start -> Control Panel -> Programs -> Turn Windows features on or off

Expand Internet Information Services -> World Wide Web Services -> Application Development Features and check CGI
Click OK and reboot your machine

Run PHP's setup again and select IIS FastCGI again. The install should go through normally now.

Enjoy!

Enable IIS7 on Windows 7 Home Premium

So I got this new PC and wanted to do some WAMP (Windows, Apache, MySQL, PHP) work on it. After 10+ years of Win XP, here I am with a Windows 7 Home Premium.

Installed Apache 2.2.17 and PHP 5.3.3 VC6 but couldn't get the 2 to talk to each other. (Apache insisted it couldn't find the PHP module)

I figured it was some bizarre permission issue that I didn't want to lose sleep over. (If you can't find something on Google within 15 minutes, it's a lost cause.)

So, I turned around and decided to try a WIMP instead. Windows, IIS, MySQL, PHP

Enough backstory. Here's how to enable IIS7 on Windows 7 Home Premium:

Start -> Control Panel -> Programs -> Turn Windows features on or off
Check the Internet Information Services once.
It'll default to a filled checkbox with the default options. It was good enough for me (for development work, not a live machine)
Click around to see what else you may need
Click OK

Windows may say it needs to restart. Go ahead.

Open up your web browser and type in http://localhost/ and the big ol' IIS7 image appears. The default root is in C:\inetpub\wwwroot\

Steps beyond this (eg: configuration, etc) is beyond the scope of this blog post.

Enjoy!

Monday, November 8, 2010

Compare MS SQL Databases

Found a tool today to help me deploy codes just that little bit faster by comparing 2 MS SQL databases.

Here's the link:

It's Freeware!

I don't think it will ALTER your databases for you. It just compares the DB structure. Doesn't compare data either, I think.

You have to resolve the differences manually and that's the way I like it.

Wednesday, November 3, 2010

MS SQL Fast SELECT a Random Row

Found this bit of code for MS SQL to quickly SELECT a random row from a table of millions of records.

SELECT TOP 1 *
FROM table_name
WHERE Primary_Key_ID = (SELECT CEILING(MAX(Primary_Key_ID) * RAND())
FROM table_name)

This is faster than the usual ORDER BY NEWID() as this method creates a temporary table (or view) with an additional column of NewIDs

The downside is that, if you have gaps in your Primary Key, you should take care of the statement returning blank rows in your code.