Installing Magento Commerce on Windows and IIS (part 1)

If you are like me that still love to stick around with IIS but want to try out Magento Commerce, I have good news. Magento Commerce works quite with some tweak. I have tried this approach on both IIS 6.0 and IIS 7.0 (each have a bit different steps).

First make sure you only use PHP 5.2+ but not version 5.3. You can use the latest MySQL or version 5 and above. Now once you have both PHP and MySQL downloaded, let’s start by configuring IIS to work with PHP first.

On part 1 of this blog, I will start with configuring PHP with IIS7 using FastCGI. If you have Windows 2008 or Windows 7, then you will be using the new IIS version 7. I typically choose the manual PHP installation process. Magento Commerce supports FastCGI, therefore, we can setup our IIS to use FastCGI. IIS 7.0 comes with FastCGI as an option when you install it. Here’s the steps:

1. Make sure FastCGI is installed with your IIS 7 (go to control panel – program and features – Turn Windows feature on or off – under Internet Information Services, make sure CGI is checked (inside world wide web services – application development feature)

IIS features

2. Unzip the PHP into a directory.

3. Next we are going to install PHP using FastCGI. Open IIS manager. In the site that you want the PHP engine to run, click on the “Handler Mappings” and add click on “add module mapping”. Enter the following:

  • Request Path: *.php
  • Module: FastCGIModule
  • Executable: {Your PHP directory, i.e. c:\PHP}\php-cgi.exe
  • Name: PHP via FastCGI

FastCGI PHP

It will prompt whether you want to create a FastCGI application for this application. Just choose “yes”.

4. On your PHP directory, make sure PHP.ini is there. You can copy from “php.ini-recommended” and rename it to “php.ini” to start with. Inside PHP.ini, these are the settings that need to be set right:

* Set fastcgi.impersonate = 1. FastCGI under IIS supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under.
* Set cgi.fix_pathinfo=1. cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP’s previous behavior was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not care what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting this to 1 will cause PHP CGI to fix its paths to conform to the spec
* Set cgi.force_redirect = 0.
* Set extension_dir to point to a location where PHP extensions reside. Typically, for PHP 5.2.X that would be set as extension_dir = “./ext”
* Enable the required PHP extension by un-commenting corresponding lines, for example:
extension=php_mssql.dll
extension=php_mysql.dll

5. Now we are ready to test the PHP.

To test your PHP installation, on your webroot, create a test php file. You can named it “phpinfo.php”. Inside simply type in the following code:
<$php phpinfo();

6. Open your browser and go to that page that you just created. If everything install correctly, then you should see all the php settings of your PHP installation.

That's it. On the next part, I will cover installing MySQL and preparing the empty database for Magento.