Install PHP5 and Apache 2.2 Server on Windows 7

Installing both PHP5 and Apache 2.2.14 on Windows 7 is pretty straightforward.  Connecting to them from another computer is a challenge.  I tried to connect to my server using both the IP address with the default port and port 8080, but they did not work.  Therefore, I had to search for a solution.

PHP5 version 5.3.1 is used.  The exact file I downloaded is called php-5.3.1-nts-Win32-VC9-x86.msi

NOTE:  Some versions do not have the php5apache2_2.dll in the PHP directory.  If this is the case, download a different version.  php5apache2_2.dll is required to work with apache 2.2.14 and Windows 7.

Apache HTTP server2.2.14 is used.  The exact file I downloaded is called  apache_2.2.14-win32-x86-openssl-0.9.8k.msi

NOTE:  PHP 5.3 VC9 is the only version that will work with Windows 7 – 64bit and Apache 2.2.  I tried using both PHP 5.2 VC6 and PHP 5.3 VC6, but they crashed.  Since there is no PHP 5.2 VC9 version, Windows 7 – 64bit users do not have much of a choice.

Looking at the PHP website, I managed to get an Apache Server 2.2.14 working on my Windows 7 computer at home.  Having a DSL modem, I discovered that it must be configured to accept incoming connections.  Therefore, will help those that want to connect to there apache server remotely through a router.

As for ports being blocked, I have a home server that is accessible through port 8080.  It is only a matter of setting up your router to unblock the port.  Unfortunately, my IP provider limits the amount of data transfer allowed per month.  Furthermore, they charge a premium for each additional GB over that limit.  Therefore, a home server that will be accessed by millions of people every day is not a good idea in my case.

These lines were added to the bottom of httpd.conf.  I am currently running Windows 7 with Apache 2.2.14 and PHP5.

LoadModule php5_module “c:/Program Files (x86)/PHP/php5apache2_2.dll”
AddHandler application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir “c:/Program Files (x86)/PHP/”

These were taken from with some modifications.  Windows 7 64-bit puts the files in a different directory.

For those unable to find where PHP was installed, findphp will search c: and list all the directories that have php.exe.  This is a batch file written in Notepad for those uncomfortable using DOS.  Another option is to do a search using Windows.  This can usually be found by clicking the button.

My httpd.conf file is posted at for those that want to see the changes that I have made.  The listen port, web page hosting directory, and PHP install directory are highlighted in bold.

Creating a home server accessible through the Internet

As for users with dynamic (changing) ip addresses, provides a solution.

For those wanting to use an address on their own website, it is possible.  One will need to create a subdomain such as  For the forwarding address, one will forward it to the address created in with port 8080.  For example,  This will enable anyone connecting to one’s server to connect to using port 8080 instead of the standard port 80.  Port 80 is blocked for many Internet users, therefore, port 8080 will have to be used. does not work.  It is documented here to show how to do it.

XDEBUG issues

Unfortunately, it seems that XDebug does not work on both Netbeans or Eclipse as of January 31, 2009.  Therefore, debugging is not possible on a Windows 7, 64-bit computer.  Looking online, it seems that I am not alone.

Therefore, the only option available is to debug using lots of echo and/or print commands.  Works great for me.

Running Apache server with PHP

For those needing to install an Apache server with PHP without the headaches, there are two options available that I know of.

WAMP and XAMPP – Both of these Apache servers installs everything required at once and works right out of the box.  PHP, Apache, and MySQL are installed by default.  XAMPP installs PERL also.  If one is finding the installation procedure  of Apache 2.2.14 and PHP5 too complicated, WAMP or XAMPP is a better alternative.

3 thoughts on “Install PHP5 and Apache 2.2 Server on Windows 7”

  1. the font in this page is changing the quotes character. right quotes are the default from keyboard: 0x22

  2. little different experience for me:

    strangely, this path>> “c:/Program Files (x86)/PHP/”
    didnt work. but this path worked: “c:/PHP/”

    also: while copy paste from the page we must remember to change the smart quotes to the normal ones:
    wrong quotes: “c:/PHP/”
    right quotes:o “c:/PHP/”

  3. Wow my php works! after so many attempts and lot of research I ended up at this site and wow.

    All window 7 users, if you want your phpto work…please follow these instructions.

    Thanks a lot

Leave a Reply