I am a web designer & developer based in Galway, Ireland. Information on my work is available from my company site: Ambient Age Web Design.

I am also completing a PhD in Information Systems. My research is on the Adoption of IT Standards for technologies to support Ambient Intelligence.

Installing Apache alongside IIS for Zend PHP Framework

After deciding to experiment with the Zend PHP Framework for web application development, I needed to install Apache on a local machine for development. I’m a novice when it comes to Web Server configuration / installation, but after reading the installation would take 15-20 minutes, I started feeling pretty dumb after a few hours of searching Google and still getting either nothing at all, or error messages.

The setup I had before the installation was XP Professional, with IIS already installed. Also there were PHP5 and MySQL 5.0.41

To try and save you a few hours you’ll never get back, here’s how I managed to get Apache / PHP / Zend up and running:

  1. Download the Apache installer (the .msi file)
  2. Install Apache using the installer and fill in the options you need
  3. Modify the httpd.conf file as follows:
    1. To get it to work with IIS you need to change the port to something other than 80 (which is the one IIS listens to by default). To do this you can search for Listen, and change the line to:
      Listen 8080 (This means that the web root document on the Apache server is accessed through http://127.0.0.1:8080).
    2. Search for rewrite_module and uncomment the line:
      LoadModule rewrite_module modules/mod_rewrite.so
      (This module is used by the Zend Framework to rewrite URLs)
    3. At the end of the LoadModule statements, add the line:
      LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
    4. Search for DirectoryIndex and change it to:
      DirectoryIndex index.html index.html.var index.php
    5. At the end of the AddType statements, add in the lines:
      AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml

It was around here that I ran into problems….

It seems obvious now (!), but even though you have PHP installed for IIS, it won’t work on Apache unless you reinstall the parts you need (…as I said, a novice). When I originally installed PHP, I downloaded a .msi file (php-5.2.3-win32-installer.msi) – so go back to where that’s saved, double click on it, and select “Next”, then “Change” and you see four collapsible lists.

From here, go into “Extensions” and select “PDO” (PHP Data Objects Support – which Zend uses)… that was figured out after some time searching for an error that said: “Uncaught exception ‘Zend_Db_Adapter_Exception’ with message ‘The PDO extension is required for this adapter but the extension is not loaded’.

Under the “Web Server Setup” list choose the Apache Version that you need (I had the most recent version, so I selected “Apache 2.2.x”).

I found that when viewing the site in Firefox, I got a “Cannot Connect to Server” when trying to view PHP files or sub-directories before the installation was set up correctly. You can also use the “Start Apache in Console” command in the Start Menu (Start >> All Programs >> Apache HTTP Server >> Control Apache >> Start Apache in Console) to see if there are errors; if there aren’t, you’ll get a blank screen, otherwise the error will be displayed.

After this, it was just a matter of following the Zend Framework installation instructions, and it was up and running…

Some tutorials that saved me even more time doing this were:
http://tanguay.info/web/tutorial.php?idCode=phpDevelopment

If there are any updates to the configuration as I experiment with Zend, I’ll add them in here, or drop them into a new post….

  • Twitter
  • del.icio.us
  • Google Bookmarks
  • Digg
  • Facebook
  • Technorati
  • StumbleUpon
  • Sphinn
  • DZone

9 Comments

Alex
January 15, 2008
9:04 am
Permalink

Consider http://www.witsuite.com to install and configure Apache, PHP, MySQL on Windows. It is simple and efficient (installation demo: http://www.witsuite.com/products/installer/). If you prefer to install packages manually, you can use the instruction at http://www.witsuite.com/support/knowledge-base/manual-installation/install-php.php

January 18, 2008
1:11 pm
Permalink

@Alex

Thanks for that, I’ve used those type of bundles on other machines before, such as The WAMP Server and XAMPP. In this case, I already had PHP & MySQL installed, and didn’t want to reinstall both again.

TractorTyre
February 29, 2008
10:36 am
Permalink

I have the smae problem and I was happy to find your post about it. I did all the steps you describe, and I still get the same error… I’m getting a bit desperate. I’m sure there is something obvious I oversee, but what is it…? Any idea?

March 3, 2008
2:58 pm
Permalink

@TractorTyre

Hi, sorry about the delay getting back to you!

The steps I followed to fix the problem are all described above, so I’m not sure what else could be causing the error you’re getting.

Have you installed the PHP PDO extension? (I’ve also got the declaration “extension=php_pdo.dll” uncommented in the php.ini file (in Program Files/PHP).

Is that of any help?

TractorTyre
March 6, 2008
1:27 pm
Permalink

Hi Dave,
thanks for the reply. I did not have the time to deal with the problem again. I was planning to uninstall everything and install again clean. I’ll let you know how it went.

March 6, 2008
5:06 pm
Permalink

@TractorTyre,

No problem. If you get it fixed an update would be good – there seem to be a lot of people coming by this page with that error.

Good luck with it!

TractorTyre
March 6, 2008
5:27 pm
Permalink

Ok, a clean install obviously helped. Thanks for sharing the instructions, helped me a lot :)

August 3, 2008
6:45 pm
Permalink

There is a way to run Zend framework under IIS 7.0 in a very convenient way. read my blog post about this if it sound interesting not having to have a dual-webserver-setup on your machine. Together with Fastcgi, PHP works perfectly under windows.

http://blog.qiui.com/index.php/2008/08/03/zend-framework-in-iis7-with-url-rewrite-module/

Hope this helps some people. I had to figure this out by myself as the module if pretty new :)

August 5, 2008
9:59 am
Permalink

Thanks for that Piotr, it looks useful.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*