XAMPP - quick way to restart apache?

Viewed 57571

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.

4 Answers

@adrianthedev's version didn't work for (XAMPP v3.2.4) me but helped me find a solution. It's a lot less sophisticated as I don't know much about scripting but here it is and it worked for me:

@echo off
C:/xampp/apache/bin/httpd -k stop
C:/xampp/apache/bin/httpd -k start

Note: apache\logs\httpd.pid doesn't need to be deleted as it's done already by the httpd -k stop command.

Related