Start/stop Apache service in Windows’s command line
To start/stop Apache service in Windows use these following commands:
Open command prompt (Start > cmd):
To stop apache:
C:\ net stop apache2.2
or to start apache:
C:\ net start apache2.2
Not quite convenient but at least It makes me feel like doing things in linux.
Comments
If you don’t have Apache installed as a service, the window will remain visible until you stop Apache by pressing Control-C in the console window where Apache is running in. The server will exit in a few seconds.
- How do I turn off Apache in Windows 10?
- How do I stop all Apache processes?
- How do I restart Apache on Windows?
- How do I stop Apache httpd EXE?
- How do I shut down Apache?
- How do I know if Apache is running on Windows?
- How do I stop all servers?
- How do I stop Apache from starting automatically?
- How do I restart Apache on Windows 10?
- Why did Apache shut down unexpectedly?
- How do I disable Httpd in Windows?
- How do I start Apache Tomcat on Windows?
How do I turn off Apache in Windows 10?
Stopping apache:
- Log in as the application user.
- Type apcb.
- If apache was run as the application user: Type ./apachectl stop.
How do I stop all Apache processes?
In order to stop or restart the Apache HTTP Server, you must send a signal to the running httpd processes. There are two ways to send the signals. First, you can use the unix kill command to directly send signals to the processes.
How do I restart Apache on Windows?
2 Answers
- Click the start button and type CMD (if on Windows Vista or later and Apache is installed as a service make sure this is an elevated command prompt)
- In the command window that appears type cd C:\xampp\apache\bin (the default installation path for Xampp)
- Then type httpd -k restart.
How do I stop Apache httpd EXE?
Of course, Windows Task Manager can also be used to stop the Apache server. Select «httpd.exe» on Processes tab on Windows Task Manager, and click the «End Process» button. Then click «Yes» on the warning message to terminate «httpd.exe». Repeat the process again if see more than one instances of «httpd.exe».
How do I shut down Apache?
Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache
- Restart Apache 2 web server, enter: # /etc/init.d/apache2 restart. $ sudo /etc/init.d/apache2 restart. …
- To stop Apache 2 web server, enter: # /etc/init.d/apache2 stop. …
- To start Apache 2 web server, enter: # /etc/init.d/apache2 start.
How do I know if Apache is running on Windows?
- Bring up the task manager by pressing Ctrl + Shift + Esc .
- Go to the Processes tab and sort by Image Name. In Server 2012, go to the Details tab and sort by Name.
- Look for apache.exe (or httpd.exe) and check the User Name column.
How do I stop all servers?
To stop all Application Servers on the host, do one of the following:
- (Windows) Do one of the following: From the command line window where the Application Server is running, enter Ctrl-C . From the Windows Start menu, select Settings > Control Panel. …
- (UNIX) Enter the following: /etc/init.d/blappserv stop.
How do I stop Apache from starting automatically?
The procedure to stop Apache from starting at boot time on Linux is as follows:
- Open the terminal application.
- Login using ssh for remote server. …
- Use sudo systemctl disable httpd && sudo systemctl stop httpd on RHEL/CentOS/Oracle/Fedora Linux.
How do I restart Apache on Windows 10?
First you must bring the command prompt to the bin of Apache folder on your computer, i.e my Apache folder is in directory C:\Apache24\ . I used command cd C:\Apache24\bin and then used command httpd -k restart to restart the Apache service.
Why did Apache shut down unexpectedly?
The XAMPP error “Apache shutdown unexpectedly” is commonly caused by another program, such as Skype, using the default Apache port. … As we discussed in this article, the easiest way to fix this problem is to update XAMPP’s Apache configuration settings. You can do this by editing the httpd. conf file and the http-ssl.
How do I disable Httpd in Windows?
Running as a service should be preferred over running in a console window because this lets Apache end any current operations and clean up gracefully. But if the server is running in a console window, you can only stop it by pressing Control-C in the same window.
How do I start Apache Tomcat on Windows?
Starting the Apache Tomcat server
- Click the Start menu and right-click Computer and select Manage.
- Expand Configuration and click Services.
- Right-click the Tomcat service and select Start.
На сайте с 23.12.2013
Offline
151
#1
А почему апач работает не как служба? В вашем случае никак.
V2
На сайте с 05.01.2012
Offline
120
#2
lonelywoolf:
А почему апач работает не как служба?
Не хочу привязки к системе, должна быть типа portable версия, скопировал на другой комп и там работает.
Кроме того мне нужно будет запустить несколько процессов apache на разных портах, а как это реализовать в случае запуска как службы тоже не знаю.
R
На сайте с 27.02.2016
Offline
66
#3
Vitaly2012:
Не хочу привязки к системе, должна быть типа portable версия, скопировал на другой комп и там работает.
Скопировать на другой ПК. Служба/сервис вас в этом ни как не ограничит.
Кроме того мне нужно будет запустить несколько процессов apache на разных портах, а как это реализовать в случае запуска как службы тоже не знаю.
Использовать директиву <VirtualHost *:8080>…</VirtualHost> с указанием нужного вам порта, IP-адреса.
На сайте с 25.01.2009
Offline
514
#4
А зачем виндоусу апач?
V2
На сайте с 05.01.2012
Offline
120
#5
Ravel:
Скопировать на другой ПК. Служба/сервис вас в этом никак не ограничит.
Как-же не ограничит, на другом пк апач не установлен как служба, нужно будет заново ставить.
Ravel:
Использовать директиву <VirtualHost> с указанием нужного вам порта IP-адреса.
Мне нужно, чтобы каждый запущенный httpd слушал свой порт, а не один httpd запущеный как служба слушал все порты.
R
На сайте с 27.02.2016
Offline
66
#6
Vitaly2012:
Как-же не ограничит, на другом пк апач не установлен как служба, нужно будет заново ставить.
Вы просто переместите свою папку (C:\Apache2 или какая там у вас) на другой ПК, а если там папка будет отличатся, внесете изменения в файлы конфигурации.
Vitaly2012:
Мне нужно, чтобы каждый запущенный httpd слушал свой порт, а не один httpd запущеный как служба слушал все порты.
Все порты он слушать не будет. Будет слушать только то, что вы ему укажете в listen и VirtualHost.
V2
На сайте с 05.01.2012
Offline
120
#7
Ravel:
Вы просто переместите свою папку (C:\Apache2 или какая там у вас) на другой ПК, ну если там папка будет отличатся внесете изменения в файлы конфигурации.
Да нет-же, простого переноса недостаточно, нужно еще выполнить httpd.exe -k install
Ravel:
Все порты он слушать не будет, будет слушать только то что вы ему укажете в listen и VirtualHost.
В случае службы он именно будет слушать все указанные в его конфиге в listen и VirtualHost порты, а мне нужно, чтобы каждый апач слушал только один свой порт.
R
На сайте с 27.02.2016
Offline
66
#8
Vitaly2012:
Да нет-же, простого переноса недостаточно, нужно еще выполнить httpd.exe -k install
Не нужно. Достаточно запустить httpd.exe в папке bin. Можете проверить на виртуальном сервере.
Vitaly2012:
В случае службы он именно будет слушать все указанные в его конфиге в listen и VirtualHost порты, а мне нужно, чтобы каждый апач слушал только один свой порт.
Зачем?
V2
На сайте с 05.01.2012
Offline
120
#9
Ravel:
Зачем?
Зачем, это другой вопрос.
А меня интересует как корректно остановить процесс httpd.
———- Добавлено 15.10.2019 в 16:08 ———-
Ravel:
Не нужно. Достаточно запустить httpd.exe в папке bin. Можете проверить на виртуальном сервере.
Хотите сказать, что apache при первом запуске сам ставится как служба никого об этом не спрашивая и не уведомляя? ))
R
На сайте с 27.02.2016
Offline
66
#10
Vitaly2012:
Хотите сказать, что apache при первом запуске сам ставится как служба никого об этом не спрашивая и не уведомляя? ))
Никто никуда сам не ставится. Вы Readme.txt читали ?
В архиве есть файл Readme.txt, в нем написано как установить Apache как сервис
To install as a service. Open command prompt as Administrator and type:
>httpd.exe -k install
You can start/stop the service with the command:
>services.msc
To see all Command line options:
>httpd -h
net start — список всех запущенных служб
net stop «<имя службы>» — остановка конкретной службы в вашем случае (net stop «Apache2.4»)
3rd June 2009 — 2 minutes read time
Following on from the post about starting and stopping MySQL using .bat files I decided to add commands to these files that also controlled Apache in the same way. This turned out to be a lot easier than trying to start and stop MySQL as the command line commands for httpd executable worked very well in .bat files.
So, to start Apache use the following line.
"C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd" -k start
And to stop the server use the following line.
"C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd" -k stop
Comments
Related Content
A Look At Benford’s Law
11th May 2025
Benford’s Law is an interesting heuristic in data analysis. It states that in any large collection of numbers that are created naturally, you should expect to see numbers starting with the number 1 about 30% of the time. The frequency distribution of numbers states that 2 should appear about 17% of the time, down to 9 being seen just 5% of the time.
Read more
Protecting A Page From Being Directly Accessed With PHP
27th April 2025
I was thinking recently about the number of ways in which I could restrict access to a page using PHP.
The obvious option is to create a user authentication system, but in some situations that is overkill for what is required. If you just want to prevent users from going directly to a certain page then there are a few options open to you.
Read more
Generating Colour Palettes From Images In PHP
4th August 2024
A common web design pattern is to incorporate an image into the design of the page. This creates a tighter integration with the image and the rest of the page.
The main issue in designing a page around the image is that the colours of the page must match the image. Otherwise this creates a dissonance between the image and the styles of the site.
Read more
Validating XML Files With XML Schema Definitions In PHP
21st July 2024
XML is a useful format for configuration, data storage, and transmitting data from one system to another. As a human readable format that can be easily read by machines it quickly gained favor in lots of different systems as a mechanism for data storage.
Read more
Approximating Pi Using A Circle And A Square
26th May 2024
Pi day was a few weeks ago, but I came across this simple approximation of pi recently and decided to put together an example in PHP since it seemed pretty simple.
This approximation of pi centers around a real world example, but we can simulate this using some code.
Read more
Today I share how you can uninstall the Apache Windows service.
Why uninstall the Apache Service
If you want to reinstall Apache you will want to remove the service first. This ensures you will be able to fully uninstall apache before reinstall.
In other situations you might want to reinstall the service with different parameters.
Uninstalling the Apache Windows Service
To uninstall Apache as a service you need to use an admin command prompt. This can be opened by typing cmd
in the search bar and right clicking it to select “Run as administrator”.
Once the command window is open you need to cd
into the bin directory of the apache folder. This is the folder that holds httpd.exe
.
To uninstall the service, if it was installed with the default name, you can run.
httpd.exe -k uninstall
If the service is installed with a custom name you can use the -n
flag to specify which apache service to remove. In the below example I am removing the apache service called “Apache HTTP Server”
httpd.exe -k uninstall -n "Apache HTTP Server"
Using these commands you can remove any Apache service installed using httpd.exe
.