Home>Article>PHP Framework> How to set workerman to start automatically after booting up (linux environment)
This article will introduce to you the method ofworkermansetting up automatic startup on boot under Linux system. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Related recommendations: "workerman Tutorial"
Step 1: Create the worker.service service file (Permission 755)
/lib/systemd/system/workerman.service
Step 2 : Copy the following code, save and exit. Pay attention to modify your worker path
## Path: /www/wwwroot/xxx.com/server.php Start command: php server.php start It can be started in the above command, the path is as follows[Unit] Description=workerman After=network.target [Service] Type=forking ExecStart=/usr/bin/php /xxx/xxx/server.php start -d ExecReload=/usr/bin/php /xxx/xxx/server.php restart ExecStop=/usr/bin/php /xxx/xxx/server.php stop PrivateTmp=true RemainAfterExit=yes [Install] WantedBy=multi-user.target
To modify this file, you must restart the server, otherwise it will not take effect
Step 3: Start the service
systemctl start workerman.service
Step 4: Check the service status
systemctl status workerman.service
Step 5: Boot up
systemctl enable workerman.serviceNote:
Introduction to Programming! !
The above is the detailed content of How to set workerman to start automatically after booting up (linux environment). For more information, please follow other related articles on the PHP Chinese website!