Joomla! on IIS

Author: Ruslan Yakushev

Published on December 12, 2008 by ruslany

Updated on December 12, 2008 by ruslany

Average Rating  Rate It (3)

RSS

Introduction

Joomla is an open-source content management system (CMS), which enables you to build Web sites and powerful online applications. Joomla is used all over the world to power Web sites of all shapes and sizes. For example:

  • Corporate Web sites or portals
  • Corporate intranets and extranets
  • Online magazines, newspapers, and publications
  • E-commerce and online reservations
  • Government applications
  • Small business Web sites
  • Non-profit and organizational Web sites
  • Community-based portals
  • School and church Web sites
  • Personal or family homepages

This article describes how to install and configure Joomla to run on Windows with IIS 6.0 and IIS 7.0. The article assumes that you have completed the setup and configuration steps necessary for running PHP applications on IIS 6.0 or IIS 7.0.

The following instructions have been tested and found to work on the following configuration:

  • Windows Server 2008 Web Edition
  • IIS 7.0
  • PHP 5.2.8
  • MySQL 5.0
  • Joomla 1.5.8.

Notes on PHP setup

Joomla does not require many modifications beyond the default configuration provided by PHP. From the base configuration file provided by PHP, you only need to modify the following lines in your php.ini configuration file to get Joomla working:

  • Define 'extension_dir' as 'c:\php\ext' (i.e., the location of your php extensions directory)
  • Uncomment 'extension=php_mysql.dll' in the extensions list to enable MySQL support

Prerequisites

In order for Joomla to work correctly with IIS 7.0 it is necessary to install an update for IIS FastCGI module for IIS 7.0. More information about the update is available here.

Download and unZip Joomla

Find the the latest release of Joomla at http://www.joomla.org. The instructions in this document are based on version 1.5.8, but future versions are likely to be very similar as far as installation is concerned. After downloading the zip package, extract its contents to C:\Inetpub\wwwroot\Joomla or another directory of your choosing.

Grant write permissions on configuration file

Joomla uses configuration file called configuration.php in order to store key configuration settings. Before running the installer you need to create this file to  give the web server write privileges to the new file. Joomla's installer will modify the configuration.php file as needed with the details you provide during the installation process.

After creating the new file you can assign write permissions to it with the command (from the installation directory):

C:\inetpub\wwwroot\Joomla>icacls configuration.php /grant BUILTIN\IIS_IUSRS:(M)

Grant write permissions to tmp folder

Joomla uses the tmp folder to store temporary files. Because of that it needs to be able to write and modify files in this folder. To enable that, grant modify permissions to this folder:

C:\inetpub\wwwroot\Joomla>icacls tmp /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)

Set up the database

Before starting the installation procedure for Joomla, create a database on your server. Also create a user and grant this user db ownership permission to the database. Follow the instructions in the Setting Up a Database for a PHP Application on IIS article for a MySQL database. This walkthrough uses the following database information:

  • Database Name: 'Joomla'
  • Database User: 'Joomla'
  • Account Password: 'Joomla'

Run the installation script

To start the installation, open web browser and request http://localhost/drupal/. This will bring up the first page of the installation script:

Choose the language and then click "Next":

Verify that all pre-installation checks are successful and then click "Next":

On this page enter the following:

  • Host Name: localhost
  • Username: joomla
  • Password: joomla
  • Database: joomla

Click "Next":

Choose not to enable FTP file system layer and then click "Next" again:

 

 Specify the site name and the administrator password. Click "Next" to finish the installation:

Delete the C:\inetpub\wwwroot\joomla\installation folder as per instructions. After the folder has been deleted you will be able to browse Joomla site:

Enabling Search Engine Friendly URLs

By default Joomla uses query string parameters for all the links URLs it generates for your web site. This behavior can be changed by enabling what is called "Search Engine Friendly URLs" in Joomla. However, this feature relies on the URL rewriting functionality to be available on the web server. IIS 6.0 does not have URL rewriting capabilities, so you could use one of the third party URL rewriting products, such as ISAPI_Rewrite or Ionics ISAPI Rewrite Filter. IIS 7.0 has URL rewriting support, which can be enabled by installing Microsoft URL Rewrite Module for IIS 7.0. The following instructions describe how URL Rewrite Module for IIS 7.0 can be used to enable Clean URLs in Joomla.

First, you will need to download and install Microsoft URL Rewrite Module. Once it has been installed, create and open a web.config file located in C:\inetpub\wwwroot\Joomla folder. Paste the following XML code into this file.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Security Rule" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="(\&lt;|%3C).*script.*(\>|%3E)" />
            <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
          </conditions>
          <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
        </rule>
        <rule name="SEO Rule">
          <match url="(.*)" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
            <add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
            <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
 </system.webServer>
</configuration>

Save the web.config file and then open web browser and logon to the Joomla administrator console at http://localhost/joomla/administrator/ . Once logged on, go to Site --> Global Configuration menu configure SEO settings as below:

  • Search Engine Friendly URLs - Yes
  • Use Apache mod_rewrite - Yes
  • Add suffix to URLs - No

Save configuration by clicking on "Apply" and then browse to http://localhost/joomla/ . You will see that now all links in Joomla pages have URLs without query string parameters and if you click on any of these links the server will return correct response:

Getting More Information

To discuss the FastCGI and URL Rewrite Module specific questions, or file bug reports, please use these forums:

To get more information regarding running various PHP applications on IIS, refer to:

Comments

  1. Submitted on Feb 10 2009 by
    johndriper
    Hi there. Great tutorial.
    Works great except for one thing (might be me).
    If I use anchor links on the site I just get redirected to the start page.
    Is it because the # character?
    Would be great if anyone has a minute to se what the error I get is.
    /John
  2. Submitted on Mar 11 2009 by
    abelanet
    Hi!

    Did everything above except for the Search Engine Friendly URL since I am using a development machine. Everything works fine except for the extension manager upload options. I get the following error

    JFolder::create: Path not in open_basedir paths
    Unable to create destination

    Anyone know why?

    Mario
  3. Submitted on Mar 11 2009 by
    abelanet
    Hi!

    A few minutes ago I posted an issue for which I have solved. It took me 4 days to find this even though it look stupid now that I found it.

    JOOMLA is case sensitive. I found out that there are 2 files that need to have the paths as windows is displaying them. These are configuration.php in the root directory of Joomla and php.ini in the root of the PHP directory.

    Make sure that any paths references are according to the case windows is displaying them. Eg Drive C is always in capital so it must be so in the both config files.

    BTW I am using joomla 1.5.9 on IIS7 with mySQL 5.1.

    Mario

  4. Submitted on Mar 11 2009 by
    abelanet
    Hi!

    It seems that Joomla only likes Linux/Unix. I am noticing that although I got it to work in uploading extensions it has got another issue. Joomla seperate directories uses the Unix/Web conversion / however Windows uses the \. I am noticing that this is confusing Joomla. Eg when I added the extension PHOCA GALLERY (www.phoca.cz) Joomla got confused when I added images. The first part of the directory for the images was using the Windows convension but the last part it was using the Unix convension. Sounds more fun. Has anyone got any idea of how to go around it? Mario
  5. Submitted on Apr 03 2009 by
    ahmetkemal
    Hello,

    I have tried this but now working for me. Please check http://www.garantimagaza.com every link turns to index. Any link works properly.

    Any idea?
  6. Submitted on May 13 2009 by
    vishweshP
    JFolder::create: Path not in open_basedir paths
    Unable to create destination


    You receive this error when the Path is not set properly in configuration file of Joomla.

    Check the configuration file and check the path. If everythng appears fine please paste the ftp information variables that are present in Joomla configuration file like:

    var $ftp_enable = '0';
    var $ftp_host
    var $ftp_port
    var $ftp_user
    var $ftp_pass
    var $ftp_root = '';

    Also, check the tmp path(var $tmp_path)
  7. Submitted on Aug 27 2009 by
    kikanshathomas
    I'm having the same problems as "ahmetkemal". I get the rewrite working but each link i click on brings me back to the index page. Am I missing a setting in the Microsoft URL Rewrite Module for IIS 7.0.

    Also, I'm using sh404SEF..
  8. Submitted on Oct 23 2009 by
    Sophorth
    I've followed the Instruction above. The urls are now shorten. Look great. But If I click on any menu link, it takes me to the front page.

    Any advice please help.
  9. Submitted on Nov 03 2009 by
    InMast
    Everything was done exactly as it is described here. And everything works fine even the SEF and mod_rewrite. But… The search does not work in Joomla. I can say that it finds exactly one page which has 404th number. If we turn it off everything works. But the main component of the site we offered does not work this way already.

    The real trouble is that it is not a test site. We have found it not to work proper two late. It has visitors already and even some first results in search engine optimization. Not one night but a weak was spend in attempts to settle this BIG problem (also some of our components are based on the internal search).

    I am not a server administrator, I am just a user of a hosing services. All I can do is just to try different web.config files (and every time I have to ask somebody to transfer .htassess file into web.config!!!).

    My hosting provider simply said to me that there most likely nothing in the article above and it’s version of web.config file to make the search to work.

    So, to be honest I am thinking that I’ve lost more than a month with starting my project within IIS. This system terns to be not friendly not only for users as I am but also for professionals that helped me…

You must Log In to comment.