Apr 13

cakephp.gifIf you are interested in using CakePHP on an IIS server, you may have experienced a few problems here and there. Mostly, the problems arise when you are trying to integrate Cake with an existing IIS server and PHP infrastructure that is large or complicated.

Regardless, I have accumulated a few tid-bits of knowledge that may save someone an immense amount of head-scratching, so hold on to your hats.

Note: I still think Apache is the preferred server for a lot of reasons, but if you are absolutely locked into IIS, then please read below. If you think you might be moving over to Apache/Linux sometime soon, seriously consider biting the bullet now. It’s sorta like saving for retirement… the more you do early on, the less of a headache it will be later.

Dustin’s Beginner Guide To CakePHP on IIS

I am assuming you have installed PHP properly and have tested your IIS + PHP configuration for correct functionality prior to attempting the Cake install. Installing PHP on IIS is outside of the scope of this tutorial, sorry.

Configuring IIS

I used Windows XP Pro IIS 5.1 for the instructions in this guide. As I roll Cake apps onto different IIS servers and versions of Windows, I’ll be sure to share what I learn in the different environments.

- Make sure that IIS isn’t checking to see if a script exists before executing.

1) Go to your server admin panel, right-click on the web server (ex: Default Web Site) and click on properties.2) Go to the Home Directory tab at the top and click on the Configuration button near the bottom of that page.

3) Find the .php extension listed in the “Application Configuration” page that appears; click on the .php extension and then click the edit button near the bottom of the page.

4) You should be on the “Add/Edit Application Extension Mapping” page: simply uncheck the “Check that file exists” box at the bottom of the page.

5) Click OK, Click OK again, Click OK once more (you should’ve closed all the windows).

6) Now restart IIS (ie: command prompt -> IISReset).

This little process fixes a few problems and was a sort of ‘magic bullet’ for many of my troubles. If you look into how Cake works and what this check box in IIS does, you’ll have a “no duh” moment like I did.

- Double check your security permissions for the Cake folders/files you dropped into your web root. Just remember that something unzipped to the desktop and copied into your Inetpub directory will often have security permissions that will prevent the server from accessing some files properly.

- Remember that the app/temp folder must be writeable by the web server (for caching). That particular problem had me scratching my head once or twice.

Configuring Cake

1) Drop Cake somewhere inside your web root.2) Go to the APP/Config folder within your cake directories. Simply un-remark (‘BASE_URL’, env (‘SCRIPT_NAME’)) at the top of the core.php config file.

You should now have a working CakePHP application inside an IIS environment. I have assumed that “pretty” URLs aren’t of great concern to you. If you absolutely must have pretty URL’s, consider a good mod-rewrite filter for IIS like Helicon Mod-Rewrite. It’s easy to use and configure, lightweight, and free for most users. If you need it, it can be done.

If you have any hints, tips, problems, or suggestions… please contribute by leaving a comment below. I am certainly not the end-all resource here as my experience is limited to a few versions of IIS (I mostly run Apache anyways).

Share your knowledge, and help make CakePHP a viable option for everyone!

12 Responses to “CakePHP On IIS Troubleshooting & Help Guide!”

  1. Anonymous Says:

    Come on now, we know how to restart IIS!

  2. Dustin Weber Says:

    Heh, sorry.. didn’t mean to offend. I actually wrote that little command-line blurb in case someone didn’t know they could easily restart IIS using the ‘IISReset’ command from the command prompt.
    - Dustin Weber

  3. sat Says:


    nice article. in my windows server i cant install mode rewite. it not possiable for my server and aslo i cant change my server. is there any other soultion for iis instulation.

    Thanks & regards

  4. Dustin Weber Says:


    If you follow the instructions of my post above, you should have a fully-functional install of Cake on IIS. It seems like you are only having issues with the mod-rewrite aspect.

    Short of a filter like Helicon’s, I honestly don’t know what other options there are in this arena. I’d honestly encourage you to look at Apache if at all possible or try to convince your server team/admin/owner to have a look at a LAMP setup instead of IIS.

    - Dustin Weber

  5. Troubleshooting your cakePhp installation « Rage Online Says:

    [...] more info here. For IIS installation, I just found this help . If you have other experience, write about it or add a comment and let us all [...]

  6. r4ccoon Says:

    you should write more on how to access your written apps in no mod rewrite env,
    like the link to access the apps, or url to the action controller..

  7. raju vats Says:

    The basic problem could not be resolved Cake Php is working good on apache but not working on iis

  8. Petixe » Troubleshooting your cakePhp installation Says:

    [...] more info here. For IIS installation, I just found this help . If you have other experience, write about it or add a comment and let us all know. CakePhp, [...]

  9. mcbeth352001 Says:

    I’m going through the cakephp blog tutorial and the part where

    “Now you should be able to point your browser to http://www.example.com/posts/index. You should see your view, correctly formatted with the title and table listing of the posts.”

    for me everything is local so http://localhost/posts/index and I get that page can not be found.

    The cake home page comes up just fine http://localhost/

    What I’m I doing wrong.

  10. Hasson Says:

    Nice man, helped me a great deal getting it to work on windows.

  11. Sharon Gilmore Says:

    Thanks for this, it really helped me out! I would prefer pretty urls, but hopefully I’ll figure those out soon!

    Just one question – how do I access the admin section without /admin/users/login being available? Thanks!

  12. James Says:

    Great article!

    The following changes I made in my cake app:
    - removed .htaccess from the app, app/webroot and cake folder
    - uncommented the line Configure::write(‘App.baseUrl’, env(‘SCRIPT_NAME’)); in core.php
    - made sure all the permissions are set to full access to the cake folder

    My homepage displays correctly but when I go to any other link it says page not found.

    My homepage url is as follows: http://localhost/blog/

    When I navigate to http://localhost/blog/post/index it says “Page not found”

    Have I missed something in the IIS 5.1 or cake configuration


Leave a Reply