Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XAMPP - quick way to restart apache?

Tags:

php

apache

xampp

I have XAMPP installed on Windows 7. I need to stop and start Apache many times every day.

Currently, I do this by opening up the Xampp control panel, clicking 'Stop' (next to 'Apache'), waiting for it to stop, then clicking 'Start'.

enter image description here

Ideally I would like to be able to do this more quickly - something like right click the Xampp icon, and choosing 'Restart Apache'. Or, even better, just a shortcut key that restarts Apache.

I know that there are two bat files with Xampp - apache_stop.bat and apache_start.bat. I've tried utilising these to get want I want. However, when you run apache_start.bat, you get a cmd window that you can't get rid of. I couldn't find a way to start Apache silently in this way.

So, basically I want to be able to quickly restart Apache (one click/shortcut key), completely silently.

Thanks in advance.

like image 571
Danny Connell Avatar asked Jul 19 '12 08:07

Danny Connell


People also ask

Do you need to restart Apache?

Apache needs to be told to re-read its configuration file before it will take account of changes, but it is not necessary to completely stop and restart our web server after each change. A rather faster mechanism is to cause it to reread its file to note changes.


2 Answers

Copy apache_start.bat and rename it to apache_restart.bat.

Change the line apache\bin\httpd.exe to apache\bin\httpd.exe -k restart

Voila, there you go with your restart script. and you can also give it a shortcut.

like image 88
DKSan Avatar answered Sep 20 '22 06:09

DKSan


If you have the Apache service monitor in your system tray, you can just open that (right click, I think?) and click "restart Apache".

If it's not in your system tray, you can find it in the /bin folder of the Apache installation (called ApacheMonitor.exe). I'd recommend making a shortcut to it in the "Startup" folder.

like image 38
Ben Avatar answered Sep 19 '22 06:09

Ben