How to Run Apache and IIS at the Same Time: Part 1

Tweet

Whether you’re a freelancer or an employee, it’s often necessary to work with a diverse range of platforms and applications to get the job done. If you’re a PHP developer, you may become involved with Microsoft SQL Server and Windows hosting. If you’re a .NET developer, you could be asked to write an Apache-based URL rewriting system. Don’t be afraid: embrace the tools and learn from the experience!

Apache IIS same PCIt’s not always that easy, of course. It’s best to use a development environment which is similar to your hosting platform so you’ll normally require either Apache HTTP Server or Microsoft Internet Information Server/Services (IIS). But what if you require both?

Do You Require Both Servers?

From a development perspective, IIS and Apache do the same thing. It’s great if you can use a similar set-up to your web host, but it’s not strictly necessary.

If your requirements are relatively modest, I’d suggest running IIS only. It’ll happily run ASP.NET, Classic ASP and PHP on the same installation.

Apache does not (directly) support ASP.NET. You can use Mono, the open source equivalent, and I suspect some clever hackers have found a way to run Microsoft’s ASP.NET on Apache. But is it worth the effort? You’ll almost certainly encounter issues — especially when using Visual Studio.

If you only want to maintain one server on your Windows PC, IIS could be the best solution.

Down on the Development Farm

If you’ve got two or more machines, then it’s straight-forward to install Apache on one PC and IIS on another. Shared folders can be configured so it’s easy to deploy and run files on a remote server.

This is a great solution if you’re working in a team and allows backup facilities to be implemented. However, it’s overkill for one person and will certainly increase your electricity bill.

Valuable Virtual Machines

VM software allows you to create a software-simulated PC inside your PC. I’m a big fan of VirtualBox, although Microsoft Virtual PC and VMware have their good points.

The advantage of a VM is that you can set up any number of server configurations and switch to the one that’s most appropriate. Developers can still access shared folders and backup systems will work just as well as on a real server.

However, VMs add an extra layer of effort and must be configured and maintained. On a single PC, you’ll also need to boot your VM whenever you start coding. That may only take a minute or two, but it’ll soon become tiresome. Finally, VMs are just blocks of data — they’re easy to back up, but they’re fragile. An OS crash, corruption, or file deletion could trash your VM and destroy your work.

If none of these solutions appeal to you, head over to part 2 — it provides two methods for running Apache and IIS on the same Windows PC at the same time.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • test2009test

    i am curious is somebody use php and iss in production ?

    • http://www.optimalworks.net/ Craig Buckler

      Funnily enough, I’ve just done it. It wasn’t out of choice, but it works absolutely fine. I know a few other companies with that set-up too — they prefer Windows because they’re familiar with its administration tools.

      Most of the time I develop on a Windows PC with local installations of Apache, PHP and MySQL. It’s got several practical benefits, e.g. IE testing is far easier.

    • wwb_99

      I’ve done lots of PHP/IIS/MSSQL setups in production. For us it revolves around the facts that we know windows and MSSQL very, very and have lots of infrastructure setup to take advantage of those platforms. Which really boiled down to no one wanted to figure out how to get our backup setup playing with *nix.

      I’d also note that in more recent times, PHP is becoming a first class citizen on Windows, especially with IIS7.

      Finally, I’ll add that I’m probably one of the few living people running IIS and Tomcat in production on the same box with both services listening on port 80.

    • Wolf_22

      Unless I’m mistaken, I believe the University I attend does it.

  • http://www.skylight-studios.co.uk tdsmithj

    I have both running on one computer. Apache and IIS.

    My Setup

    Apache
    PHP
    MySQL

    IIS
    SQL Server
    ASP.NET

    One of the reasons why they don’t work together because you either have PHP both installed on IIS and Apache or they are both running through the same port. IIS runs through port 8080 and Apache runs through port 80.

  • Anonymous

    The other day I set up XAMPP on my Windows server, which also has an ISS site running. I managed to somehow get both working at the exact same time.
    It could have possibly happened because I only have a standard account (not an administrator account) and IIS runs as a service and Apache is only run when I log on and run the XAMPP control panel.
    But I dont understand, how does Windows choose Apache for me only and ISS for other visitors??