Question

I am experimenting with WP-CLI on Windows 10 and XAMPP. I probably don't understand how it works, because I expected stopping Apache from the XAMPP Control Panel would stop WP-CLI script execution on the command line.

I have a long running script in a plugin class with a progress bar. I started running it, and then decided I wanted to make some modifications. I stopped Apache and MySQL from the control panel, and the progress bar kept going. It seemed like the script did not stop running.

Does WP-CLI "run" it's own server of some kind? Is it possible to kill all running processes in WP-CLI?

Was it helpful?

Solution

I stopped Apache and MySQL from the control panel, and the progress bar kept going. It seemed like the script did not stop running.

Correct, WP CLI has nothing to do with Apache, Apache serves browser requests. MySQL might be used by WP CLI, but WP CLI doesn't run on MySQL. A kitchen doesn't cease to exist if you remove the fridge.

Does WP-CLI "run" it's own server of some kind?

No, there are no servers here, that's not how WP CLI and command line programs work.

WP CLI is a PHP command line tool, PHP is running the same way any other command runs, and is exited the same way any other command is exited.

You abort WP CLI commands the same way you would any other CLI command:

  • cmd + c on a Mac
  • ctrl + c on other platforms
  • closing the terminal
  • Task Manager ( php.exe? )

Remember, there is no server, no browser request, no URL, no cookies, no current user, no HTTP headers, because there is no browser, no server, it's just PHP code directly running on a computer. It's just another program the same as rsync, cmd.exe, or even msword.exe.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top