Installing CakePHP on IIS 7

Posted: Apr 03, 2009  4 comments  

Average Rating

Tags
CakePHP
configuration
IIS 7
mod_rewrite
PHP
URL Rewriter

Share this Post

Recently I spoke with someone on Twitter who was having issues running CakePHP on IIS. With all the talk about ASP.NET MVC on IIS, folks forget that the MVC pattern works in other languages as well. CakePHP provides MVC  development on PHP. That said, I wanted to dive in and see what the issues were involved in getting this project up and running on IIS 7. I managed to get it installed pretty quickly, but it does take a little tweaking to get you up and running. I've chronicled my adventures with CakePHP below in case anyone else is having issues. That said, I must first say that I am not an expert working with CakePHP. This was my first experience with the project, so this information is provided "as-is" and should be taken with a grain of salt. With this demo, I’ll be walking through the "Cake Blog Tutorial” offered on cakephp.org, and modifying it as needed to work with IIS 7. That said, let's get started.

[continue to Tobin Titus' blog]

Comments

Personally I always find a lack of confidence in products that cannot even be bothered to write their own installation guide on how to install/configure.

I mean IIS 7 is not *that* new anymore. If they want Windows users (what that about a third of websites out there) they should write their guide.

Respect for doing it but it will not ensure me in  confidence of the product.

Apr 03 2009 by Rovastar

Thank you very much for your comments. Matt, I know you have a lot on your plate to learn already. I know IIS is in there, so I'm not concerned if CakePHP installation isn't the top of your list! :)

John (Rovastar),

On some level, I can agree with you. It doesn't make sense that you wouldn't include installation instructions for IIS -- particularly in this day and age. That said projects built on open source often depend on the community to build help and documentation the same way that they depend on them to build the projects to begin with. CakePHP is a commercial application, so it does suprise me a little at the lack of docs for IIS but I don't mind contributing if it helps our customers get the information they need.

Apr 03 2009 by TobinTitus

<rewrite>

<rules>

 <rule name="Imported Rule 1" stopProcessing="true">

  <match url="^(.*)$" ignoreCase="false" />

  <conditions logicalGrouping="MatchAll">

   <add input="{REQUEST_FILENAME}"

        matchType="IsDirectory" negate="true" pattern=""

        ignoreCase="false" />

   <add input="{REQUEST_FILENAME}"

        matchType="IsFile" negate="true" pattern=""

        ignoreCase="false" />

  </conditions>

  <action type="Rewrite" url="index.php?url={R:1}"

          appendQueryString="true" />

 </rule>

 <rule name="Imported Rule 2" stopProcessing="true">

  <match url="^$" ignoreCase="false" />

  <action type="Rewrite" url="/" />

 </rule>

 <rule name="Imported Rule 3" stopProcessing="true">

  <match url="(.*)" ignoreCase="false" />

   <action type="Rewrite" url="/{R:1}" />

 </rule>

 <rule name="Imported Rule 4" stopProcessing="true">

   <match url="^(.*)$" ignoreCase="false" />

   <conditions logicalGrouping="MatchAll">

    <add input="{REQUEST_FILENAME}"

         matchType="IsDirectory" negate="true"

         pattern="" ignoreCase="false" />

    <add input="{REQUEST_FILENAME}" matchType="IsFile"

         negate="true" pattern="" ignoreCase="false" />

   </conditions>

   <action type="Rewrite" url="index.php?url={R:1}"

           appendQueryString="true" />

 </rule>

</rules>

</rewrite>

Jun 04 2009 by TobinTitus

I see from your configuration that you are running PHP in Isapi mode. Run PHP in FastCGI mode and you should correct your problem with URL Rewriting.

Nov 16 2009 by TobinTitus