Run the command before exiting apache / xampp

Is there a way to run a command / method when Apache is about to exit?

I have an application running on Windows with Xampp (for local use only) and you want to do some kind of cleaning method when this application finishes by the user, which happens when the Apache stop button is clicked.

So, any event triggered by xampp or apache or even php that I can use? And the command can be from cmd, php, whatever.

OBS: there must be something before apache closes, so checking windows windows list is not an option.

+4
source share
3 answers

IMO, , Apache .

, XAMPP .

:

  • cmd
  • XAMPP Apache bin
  • Apache , httpd -k install
  • Apache
httpd -k stop
httpd -k start

,

  1. , , , Apache

cleanandstopapache.bat:

clean.bat // or what ever calling cleaning command.
pause // just to test pause
httpd -k stop // stops Apache

:

  • XAMPP . , , Apache, , script Apache .
  • XAMPP GUI XAMPP, .
  • , .
  • , Windows.
+2

Apache-end. ?

, , __deconstruct() appripriate.

, ignore_user_abort() register_shutdown_function().

Apache, script , , Apache .

+1

, stackoverflow " PHP script / Apache (Windows Server)


%APACHE_HOME%\bin\httpdVendor.exe -k runservice

%APACHE_HOME%\bin\httpdVendor.exe -k stopservice

, ,
:)

:)

+1

Source: https://habr.com/ru/post/1654174/


All Articles