January 15, 2009 9:30 pm GMT
Installing Apache 2.2 on Windows 7 (beta)
by Gary IllyesI know, I know. Why would anyone want to install Apache on a beta operating system. But why not? I installed because I was interested whether Apache works on Windows 7 or not . And it does work.
I chose this time the already compiled version, coming with MSI installer, I advice you the same. Let’s see the install process step by step:
- Go to Apache Download Page and grab one of the Windows binary versions
- Run the downloaded installer
- From Start>>All Programs>>Accessories open the Command Prompt
- Now switch to the Apache’s bin directory by typing
cd c:\progra~1\apache~1\apache2.2\bin\ - We want now to fire up the Apache service. Type
httpd.exe -k installand you should see something like this:

Before you panic, the error message means that we don’t have privilege to access the Service Manager. This annoyance is part of the security measures taken by Windows 7 (and Vista) which blocks the user to take actions which may potentially harm the operating system. To fix it, type exit in the Windows 7 command prompt and read further. - Click Start and you should see the Command Prompt shortcut pinned to the quick menu. Right click it and select Run as administrator
- Now let’s switch to the Apache Bin directory again by typing
cd c:\progra~1\apache~1\apache2.2\bin\ - type:
httpd.exe -k installand you should see this:
- Open up the httpd.conf with Notepad, change the Listen variable to
Listen 127.0.0.1:8080and the ServerName variable toServerName localhost:8080, as shown below.


This way you will be able to access your HTTP server both typing localhost:8080 and 127.0.0.1:8080 in the address bar.
If you would like to use just simple plain ‘localhost’ and 127.0.0.1, change the Listen variable toListen 127.0.0.1:80and the ServerName variable toServerName localhost:80 - From Notepad’s File menu select Save As…, choose the Desktop (Important) as Save as location and change the Save As Type option to All files. Name your file httpd.conf and hit save
- Now enter My Compute>>C: (or the drive where Apache is installed)>>Program Files>>Apache Software Foundation>>Apache2.x>>conf . Leave the window open cos we will need it, minimize all other windows and drag the httpd.conf you saved on the Desktop to the one you just opened. Hit Move and Replace, hit continue and finish the move.
- Back to the Command Prompt. If you closed it previously, change the path to the Apache2.x\bin and type
httpd.exe -k start. - As a final step, let’s see if we succeeded. Start up your favorite browser and type in the address bar localhost:8080 (respectively only localhost). If you see something like this, you just managed to get Apache working on Windows 7
Questions? Ask below…
















Marvin Ochieng on Sun, 25th Jan 2009 7:31 pm
Hi,
I tried unsuccessfully a couple of times to install apache on windows 7 beta. this is the error i get:
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
help please
methode on Sun, 25th Jan 2009 9:06 pm
Hi Marvin,
Socket errors generally means that Apache can’t glue itself on a specific port or protocol, in my case port 8080, as I see in your case the 80.
As the error message says, the service didn’t get permission to bind to a specific IP:PORT. This can be solved either by starting it up from the command line which previously was started up As Administrator or by shutting down the service which controls the permissions, UAC by name.
I would never recommend to turn UAC off, it’s a great way to protect your system, even if it’s annoying that your PC always asks you that “Are you sure you want to delete C:\WINDOWS?”
Please follow the instructions: start the command prompt AS ADMINISTRATOR then switch to the Apache dir and follow the instructions we provided in the above how-to.
You may also want to check whether your firewall put restriction on localhos or 127.0.0.1.
Marvin Ochieng on Sun, 25th Jan 2009 9:24 pm
Thanks for your feedback. At the time of posting my message, i had UAC off and had also started command prompt as administrator. let me look at the firewall option and will give you feedback in a few minutes
Marvin Ochieng on Sun, 25th Jan 2009 9:29 pm
Still getting the same error. Any more ideas?
methode on Sun, 25th Jan 2009 10:01 pm
Yeah.
If you have IIS also installed, that probably listen to the same port/ip as apache would like to. Uninstall/stop the IIS server from the Administration tools/services
It is also possible that another software you installed bind itself to the particular port. In this case you will have to find the particular program which stops Apache to bind accordingly.
You could also try to set apache from the httpd.conf to listen on a port other than 80. If it starts up as it should, you will know that another program already listens on 80. You will have a starting point from where you can debug further.
As an end note, you can try to access from the task manager/performance tab the resource manager, switch to the networking tab and see what program uses the port you want apache to listen on.
Marvin Ochieng on Mon, 26th Jan 2009 5:43 am
I changed the port to 8080 and it worked. Seems like something is listening in on port 80. I’ve gone to the networking tab on task manager but i dont know where to look at to see whats bound on port 80.
looking at the servies tab, i see some services that i was not farmiliar with from previous versions of windows. i cannot tell whether iis is installed but i see the following services that look like may be the impeding factors:
WinHttpAutoProxySvc
WebClient
i’ll try stop the last one and will let you know if it was successful
methode on Mon, 26th Jan 2009 5:58 am
The two service you mention should not be started by default.
The first detects proxy settings for example the web browser if that’s set to connect through a proxy.
The second, WebClient, is for native support for manipulating web based content/files. For example is needed if you access a website through WebDAV.
I see no reason for these services to be started.
To access the resource manager from the task manager, switch to the Performance tab, then in the bottom of that tab look for a Resource Manager button. It’s one of the most useful things in Windows 7. At least for me
Marvin Ochieng on Mon, 26th Jan 2009 6:48 am
the resource monitor has just blown my mind away! i’ve checked the ports, it says port 80 is being used by system, is there a way of checking what service has taken it? IIS is not installed by the way.
Im also having a problem installing postgrade sql, the system creates a new windows user with the database logins i input when installing postgrade sql, thats very weird and scary
methode on Mon, 26th Jan 2009 7:07 am
Hmm. “System” is a bit wide range data: it can be anything started by scvhost, for the matter of the example. But it can also be any other program which is running as a background service or has to use a loopback. Just great.
Could you try to restart your computer disable your net connectivity and see if the system still binds something to port:80?
Am not familiar with PostGre and don’t want to say some misleading idiocy, sorry.
Marvin Ochieng on Mon, 26th Jan 2009 8:59 pm
sorry went away. “Could you try to restart your computer disable your net connectivity and see if the system still binds something to port:80? ” released port 80 and finally managed to install apache..
thanks alot, you have been of great help and an eye opener too..
methode on Mon, 26th Jan 2009 9:30 pm
With much pleasure,
Have a great day
Artx on Tue, 3rd Feb 2009 5:51 pm
Socket error, as I believe is because of skype – it uses port 80 as alternative
…turn off skype and run apache to see if problem still persists
methode on Wed, 4th Feb 2009 6:52 am
Good advice. I didn’t know Skype uses port 80. Thanks for your input
César Couto on Thu, 12th Feb 2009 7:00 pm
Hey guys, i’ve installed apache2 php and mysql on windows 7 beta without any problems, but i can access to my server over other computers in the network. I’ve even tryed to disabled everything in the windows 7 beta firewall but without sucess. Everything works well internally but i can’t access from outside.
Anyone has any sugestion ?
methode on Thu, 12th Feb 2009 7:17 pm
Hi César, (what a cool name
)
I’m not sure whether I understand correctly what you said: you can access the server locally but not from over the network?
If that’s the case, try to access the server over its private network IP. For example 192.128.0.1:80, just don’t forget to replace the IP with the server’s private network IP. If 127.0.0.1:80 works locally, this should work on the network too. This way you avoid Windows’ buggy name server.
If it doesn’t, make sure IPv4 protocol is enabled for the ethernet card you are using.
César Couto on Thu, 12th Feb 2009 7:24 pm
Yes methode, you understand right, but i can’t access.
The IPv4 is enabled and my ip address is 192.168.2.123
If i put http://192.168.2.114 or http://192.168.2.123:80 in another machine it does not work. This always worked for me always before in windows xp and vista, only not working now with this windows 7 beta. I’ve tryed to disabled the firewall without sucess.
In httpd.conf I have this:
ServerName localhost:80
Listen 80
I really don’t see where it can be the problem :\
César Couto on Thu, 12th Feb 2009 7:30 pm
Hey guys, solved. I’ve restarted the computer and disabled the settings for the home and work networks and it’s working. I don’t know what’s specificaly blocking… have to find out. But thanks
Mikel on Mon, 23rd Feb 2009 6:45 am
Installed Apache 2.2 and PHP5.2.8 on Windows 7 Beta.
Works perfect!
Thank You very much from Brazil!
Mikel
methode on Mon, 23rd Feb 2009 7:35 am
Glad we could help.
Vijay on Sat, 18th Jul 2009 7:36 pm
Hi,
I just tried running apache on windows7.. just wanted to let you know that i’ve turned off UAC and uninstalled IIS.. before i started installing apache 2.2.
Now this is what’s happening i can get it to work if i type 127.0.0.1 on the address bar but if i type localhost couldn’t get it to run..
i have tried changing the port to 8080 and back to 80 in the conf.. file but hasn’t made any difference..
Waiting for reply..
Thanks for your time
yibin on Sun, 19th Jul 2009 8:26 am
hi,
my apache2.2 error log
[Sun Jul 19 16:01:51 2009] [warn] pid file I:/win7_amp/Apache2.2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
Starting the Apache2.2 service
The Apache2.2 service is running.
pid file I:/win7_amp/Apache2.2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
Starting the Apache2.2 service
The Apache2.2 service is running.
pid file I:/win7_amp/Apache2.2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
pipi on Thu, 30th Jul 2009 9:31 am
yeah … it was skype … why the heck would use port 80 ? its idiotic …
Dave Fowler on Fri, 31st Jul 2009 3:22 pm
I was having problems getting xampp for windows to run on 7 until I found this page. Worked like a charm after one additional change. Apache wouldn’t start until I edited the extra/httpd-ssl.conf file to listen 127.0.0.1:443.
Gary, I thank you.
Lith Imad on Tue, 11th Aug 2009 1:25 am
Hey ,, thx for the great post …
I did all the steps you mentioned up there ..
and everything is OK ,, but when I cant enter to ” PHPMYADMIN ”
and it keep loading forever :S :S … can you help me plz ?
Mohamed essayed farag on Fri, 18th Sep 2009 1:37 am
hi I really face a very bad problem.It is that I have installed xampp 1.7.2 on my pc on windows 7.apache server doesn’t work also mysql.even if I try to start them it tell me that
busy
apache service started
but not working
I really need a solution
Jose on Tue, 20th Oct 2009 10:05 pm
muchass gracias… andaba con este problema hace muchos dias y gracias a que encontre esta pagina lo pude solucionar..
thank´s for you…
Mr. Nyerere on Sun, 15th Nov 2009 8:24 pm
Ok i get the “it works” page which is located in the htdocs folder in the apache folder. Now i went ahead and changed my document root then restarted apache and I still get the “it works” page. Now I add in another file to the htdocs even when in my conf file it points to a DIFFERENT folder. When I go to link say localhost/testpage.html that page is full of content and when i go in my browser to localhost/testpage.html, i still get “it works”. So no matter which page I go to in the htdocs root directory its like it internally redirects to the indexpage content of which I HAVE CHANGED and it still shows “It Works”.
i have no idea what on earth is going on with this its bizarre, never had that issue when using windows xp.
Ivan on Wed, 25th Nov 2009 6:13 pm
? ????? ?? ????: ???????? ??????? ??? ?????? ??? ???? ????????, Apache2.2 ????????!
Roozbeh on Sat, 28th Nov 2009 11:15 am
Thank you very much buddy.
It helped me a lot.
abadi86 on Tue, 8th Dec 2009 2:23 pm
thnx
but where tha location that can bot our files
Ugo on Tue, 29th Dec 2009 2:52 am
Thanks! Got some problems with registering Apache as a service but your article got me up and running
aNDY on Wed, 6th Jan 2010 1:02 pm
When I run test.php the browser just wants to download the file. Where am I going wrong? I have Windows 7 Pro, by the way.
Giuseppe on Thu, 14th Jan 2010 2:54 pm
super sweet! thanks very much!
Alex on Thu, 14th Jan 2010 7:58 pm
I can’t get c:\progra~1\apache~1\apache2.2\bin\ before I fully installed msi apache. When I run httpd.exe -k install I get:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd c:\progra~1\apache~1\apache2.2\bin\
c:\PROGRA~1\APACHE~1\Apache2.2\bin>httpd.exe -k install
[Thu Jan 14 22:57:44 2010] [error] Apache2.2: Service is already installed.
c:\PROGRA~1\APACHE~1\Apache2.2\bin>
what is it, what’s wrong?
Helen on Sun, 17th Jan 2010 6:16 pm
Hi, I am having tha same problem as Mr. Nyerere. Whatever I write in index file in htdocs folder it always shows “It works!”. Anyone can help please?
Drinnon Nyerere on Mon, 18th Jan 2010 1:01 pm
Helen let me tell you how easily I solved my problems, its like a mysterial thing. instead of manually going to the conf location and editing, go to the start menu,then all programs. then look for your apache progranm in my case “Apache HTTP Server 2.2″ click that folder and you will see another sub folder in there called Configure Apache Server, then you will see “Edit the Apache httpd.conf Configuration File” click that file, make your edits there, save then restart apache server and you will be on your merry way. remember i didnt tell you to manually go to c:/program………… but go to start, then all programs and follow what I said above.
it will WORK, guaranteed
sammy on Wed, 20th Jan 2010 4:11 pm
hey hi ..i jst using windows 7 .. nd i installed packed exe of WAMP ..i tried to start services bt Apache server is nt installing can u help me out .. !! m waitin ..
Umart on Wed, 27th Jan 2010 4:17 pm
Thanx a lot for article.
Windows 7 isn’t beta allready and your article was helpfull for me to install apache and start learning php.
Thanx a lot, dude!
Peter Mandal on Fri, 29th Jan 2010 5:46 pm
Many thanks for the above!
Was baning my head against a wall for a while and of the many solutions/procedures I tried on the Web yours worked!!
Thank you again!!
Felipe on Wed, 3rd Feb 2010 9:55 pm
Thanks !
It works !
tania on Thu, 4th Feb 2010 4:43 pm
Hello,
First of all, thanks for the article.
I’m getting a similar to César problem- can not access Apache from outside. I tried Following his tricks (disabled Windows firewall, tried to disable home and work networks settings, even added a rule to allow port 80 through the firewall) – nothing helps. Only localhost and 127.0.0.1 work. I have even specified DcoumentsRoot to another location from httpd.conf. Just nothing helps, my external IP does not access Apache.
After all efforts, I tried Apache with my secondary Win XP- all is brilliant, works out-of-the-box, which means my router is configured correctly, ports are forwarded etc.
There is something Windows 7 security specific. Please think what else could help me??? I appreciate your assistance a lot.
Btw, the error massage states HTTP 404 file can not be found.
Thanks
Frodo on Tue, 9th Feb 2010 7:03 pm
I was able to get Apache running on Win 7 Ultimate quite easilly except for one thing, it kept giving me an error that “RootDocument C://……. must be a valid directory”. I keep my development web files in a directory “TEST WEB FILES” in My Documents, for ease of backup. Only when I moved the web files’ folders out of My Documents and adjusted hpptd.config accordingly would it start up. Using WIn XP os this is not a problem.
Frodo on Wed, 10th Feb 2010 7:45 pm
A follow up on My Documents problem. My being a newcommer to WIndows 7 and straight from win XP, I made an assumption, erroniously. The folder shows up in Win Explorer as “My Documents” but infact the correct name of the directory/folder is plain old “Documents”. I put the TEST WEB FILES back in “Documents” and adjusted httpd.conf and all works well.
Theda on Mon, 15th Feb 2010 2:57 am
Thank you. This discussion helped me a lot. Been able to successfully installed apache on my win 7.
krisna on Fri, 19th Feb 2010 5:23 pm
i am getting an error server root must be a valid directory what i have to do ans plzzzzzzz
Anuradha on Sat, 20th Feb 2010 1:13 am
It’s succeeded.. thanks…
Pete on Wed, 24th Feb 2010 2:22 pm
Unless I completely disable the Windows 7 firewall, I can’t access apache 2.2 from any other machine on the network.
I know its the firewall settings because all other machines (two vista laptops, an XP laptop and an iTouch) can see and connect to the Windows 7 machine.
I have even modified drivers/etc/hosts file on the laptops to include an entry for lh.domain.com so that we can access the apache by URL.
Any suggestions?