Start and Stop
Note that commands related to starting and stopping Workerman are completed in the command line.
To start Workerman, you first need a startup entry file that defines the ports and protocols the service listens to. You can refer to the Getting Started Guide - Simple Development Example Section.
Here, we take workerman-chat as an example, with its startup entry being start.php.
Start
Start in debug mode
php start.php start
Start in daemon mode
php start.php start -d
Stop
php start.php stop
Restart
php start.php restart
Smooth Restart
php start.php reload
Check Status
php start.php status
Check Connection Status (requires Workerman version >=3.5.0)
php start.php connections
Difference between debug and daemon modes
-
When started in debug mode, the output from functions like echo, var_dump, and print will be directly displayed in the terminal.
-
When started in daemon mode, the output from functions like echo, var_dump, and print will be redirected by default to the /dev/null file. You can set the file path by using
Worker::$stdoutFile = '/your/path/file';. -
When started in debug mode, Workerman will terminate and exit when the terminal is closed.
-
When started in daemon mode, Workerman will continue to run normally in the background even if the terminal is closed.
What is a smooth restart?
Refer to Smooth Restart Principle