Search code examples
phpapachexampp

XAMPP - quick way to restart apache?


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.


Solution

  • 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.