Author |
|
Anturis
Joined: 20 Apr 2011 Posts: 7 Location: Turkey
|
Posted: Wed 20 Apr '11 10:37 Post subject: How to Install Apache on Windows |
|
|
Hi,
Sorry for this very basic question. I was able to install Apache 2.2.17 from http://httpd.apache.org/ and it worked fine. Then, I noticed that I needed Apache Lounge build to use with PHP 5.3.6.
I uninstalled Apache and then downloaded Apache 2.2.17 (httpd-2.2.17-win32-x86-ssl.zip) from http://www.apachelounge.com/download/.
I extracted the files to the installation folder.
ReadMe.txt says
"Start apache in a DOS box:
>httpd.exe
Install as a service:
>httpd.exe -k install"
Can you please tell me how to do that? What exactly is DOS box? I guess it is not the Command Prompt.
Please help. Thanks. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 20 Apr '11 10:39 Post subject: |
|
|
The dosbox is the command prompt (cmd.exe) even it not DOS at all
There is also a ful howto in the forum http://www.apachelounge.com/viewtopic.php?t=2394
if you still have a question please ask again |
|
Back to top |
|
Anturis
Joined: 20 Apr 2011 Posts: 7 Location: Turkey
|
Posted: Wed 20 Apr '11 11:25 Post subject: |
|
|
Thanks James, the problem was that I was not typing the full address of httpd.exe (C:\Apache\bin\httpd.exe) into the command prompt.
Now it is up and running. But I have some questions.
Where can I set it to autostart (so that it will start when I turn the PC on)?
Do I need to set network domain and server name to localhost? If yes, how?
Thanks,
Nail |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 20 Apr '11 14:46 Post subject: |
|
|
nailyener wrote: |
Where can I set it to autostart (so that it will start when I turn the PC on)?
|
with the httpd -k install you installed apache as service in windows. From now on it will start every time windows starts. If you wanna start it now use
httpd -k start
nailyener wrote: |
Do I need to set network domain and server name to localhost? If yes, how?
|
Depends on your needs. Mostly you don't have to. If there is an error about ServerName in your error log or the command prompt you can add
Code: |
ServerName localhost
|
to your httpd.conf
If you wanna run multiple domains you have to use virtual hosts (vhosts).
using vhosts local you can use your hosts file. Otherwise you need a DNS server.
if you still have a question please ask again |
|
Back to top |
|
Anturis
Joined: 20 Apr 2011 Posts: 7 Location: Turkey
|
Posted: Wed 20 Apr '11 15:00 Post subject: |
|
|
James, thank you very much, it seems the localhost is running properly. Since you are encouraging me about asking questions, I will ask some more
So, everything is set up and running smoothly now. I am testing some PHP and MySQL scripts now. There is a small issue about the localhost.
For example, I have a folder named mytest in the htdocs folder and I have an index.php file inside it. When I go to http://localhost/mytest/, it shows
Index of mytest
Parent Directory
index.php
instead of showing the content of index.php file. Do I need to change a setting in httpd.conf or php.ini? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 20 Apr '11 22:51 Post subject: |
|
|
DirectoryIndex is to handle this |
|
Back to top |
|
Anturis
Joined: 20 Apr 2011 Posts: 7 Location: Turkey
|
Posted: Thu 21 Apr '11 10:46 Post subject: |
|
|
Thanks, in httpd.conf file, I changed
DirectoryIndex index.html
to
DirectoryIndex index.php
Now it works. No more questions at the moment |
|
Back to top |
|
newbie
Joined: 17 May 2011 Posts: 3
|
Posted: Tue 17 May '11 19:06 Post subject: Unable to install Apache on my windows 7 machine |
|
|
I have tried unsuccessfully to install the Apache 2.2.18 from AL on my Windows 7 machine.
Every time I open a Command Prompt and navigate to the httpd.exe it outputs this and stalls:
C:\Apache2\bin>httpd.exe
httpd.exe: Could not reliably determine the server's fully qualified domain name
, using 192.168.1.104 for ServerName
I tried editing the httpd.conf file and adding the localhost option for ServerName and now, when I try to start up the httpd.exe it just stalls and does nothing.
I previously ran Apache 2.2.17 from Apache Software Foundation, installed using the msi. I uninstalled it and deleted all directories and uninstalled the service before trying to use the version from AL, but it just won't go beyond this point.
Does anybody have any idea what is going on?
PS: I only use my computer for development so no domain name has been assigned to my IP address. |
|
Back to top |
|
Virsacer
Joined: 16 Jan 2010 Posts: 108 Location: Germany, Darmstadt
|
Posted: Tue 17 May '11 21:18 Post subject: Re: Unable to install Apache on my windows 7 machine |
|
|
newbie wrote: | Does anybody have any idea what is going on? |
It is not stalling. It is serving HTTP requests...
If you want to install it as a Service you have to call Code: | httpd.exe -k install |
|
|
Back to top |
|
newbie
Joined: 17 May 2011 Posts: 3
|
Posted: Wed 18 May '11 0:54 Post subject: Re: Unable to install Apache on my windows 7 machine |
|
|
Virsacer wrote: | newbie wrote: | Does anybody have any idea what is going on? |
It is not stalling. It is serving HTTP requests...
If you want to install it as a Service you have to call Code: | httpd.exe -k install |
|
Okay. Just gave it another shot and so far when I start the service and test from the browser, apache works. Still a newbie here, so I kinda expected some kind of feedback from the command prompt .
However, like before, when I try to install as a service it fails. Outputs:
c:\Apache2\bin>httpd.exe -k install
Installing the Apache2.2 service
(OS 5)Access is denied. : Failed to open the WinNT service manager
Just to note, I am logged into the computer as the Administrative user.
Thanks very much. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 18 May '11 6:02 Post subject: |
|
|
Be Administrator. Actually, just right click on the Command Prompt and choose "Run as Administrator". Even though you are and Administrative user you are not Admin, you are just allowed to OK things. The console window needs to be run by actual admin or as I just said above, run as one. |
|
Back to top |
|
newbie
Joined: 17 May 2011 Posts: 3
|
Posted: Wed 18 May '11 17:29 Post subject: |
|
|
glsmith wrote: | Be Administrator. Actually, just right click on the Command Prompt and choose "Run as Administrator". Even though you are and Administrative user you are not Admin, you are just allowed to OK things. The console window needs to be run by actual admin or as I just said above, run as one. |
Just followed your suggestion and it worked. Thanks so much guys. You're all the best. |
|
Back to top |
|
voxel
Joined: 21 May 2011 Posts: 1
|
Posted: Sat 28 May '11 11:52 Post subject: |
|
|
About Windows 7 I read somewhere that it was using "localhost" for something, forcing using 127.0.0.1 instead (at least in EasyPHP it's the trick to be able to run it on 7) |
|
Back to top |
|
odry147
Joined: 21 Jul 2011 Posts: 1 Location: USA
|
Posted: Thu 21 Jul '11 14:24 Post subject: |
|
|
Sorry, may be my question is a little out of the topic but still:
As soon as I move the DocumentRoot from the htdocs location, I get a 403 Access Denied error. I'm running Apache on Windows Server 2008, and it was working before I tried to sort out password protection using .htaccess etc. I uninstalled Apache, and deleted all related files in my I Flight Systems I could find but it keeps coming back with the same error!
Any ideas?
Modenote: removed spam link
Last edited by odry147 on Wed 22 May '13 10:53; edited 1 time in total |
|
Back to top |
|
Sob
Joined: 19 Apr 2008 Posts: 30
|
Posted: Thu 21 Jul '11 16:13 Post subject: |
|
|
There's also <Directory "C:/your/original/htdocs">, you need to change that too. |
|
Back to top |
|