Home >PHP Framework >Workerman >Graphical tutorial on deploying workerman to windows server

Graphical tutorial on deploying workerman to windows server

尚
forward
2019-11-26 15:33:293104browse

The following column workerman php tutorial will introduce you to the method of deploying workerman to the windows server. I hope it will be helpful to friends in need!

Graphical tutorial on deploying workerman to windows server

Both swoole and workerman can realize the function of instant messaging. Swoole is a PHP extension written in C language. It is more troublesome to configure, but the performance is still very powerful. These can Go to the official website and search it yourself. Another one is the Workerman framework! (Recommended: workerman tutorial)

It is indeed a framework written in PHP and uses things in PHP socket. If you are deploying the project to a Linux server, I think both are fine, but if you are using a Windows server, you will face a difficulty - swoole does not support the Windows environment.

Of course, if you have to arrange it, you can use docker, but it always feels a bit nondescript (not that docker is nondescript, docker is indeed powerful), so what should we do? ? At this time, the advantages of Workerman are highlighted! It can run on windows system.

Download this chat room project

workerman chat room: http://www.workerman.net/workerman-chat

Click start_for_win.bat and a black window will appear. Browse http://127.0.0.1:55151 in the browser and you can see the chat room page! But when we close the black window, we will find that there is nothing when browsing port 55151! When the project is actually deployed, I think this is very unsafe, so we need to find a way to implement the daemon process and run this bat file as a windows service. Next, I found nssm and used nssm to convert the bat into a service.

Download the nssm software first, just search for it on Baidu! After downloading, unzip a compressed package and find the 32/64-bit nssm corresponding to your own system (find the nssm under the path in the cmd window) and execute nssm install For example: nssm install workerman

Graphical tutorial on deploying workerman to windows server

Then press Enter to display the nssm configuration interface. Fill in the bat file address in your project in the interface, for example

Graphical tutorial on deploying workerman to windows server

Click install service , as shown in the figure

Graphical tutorial on deploying workerman to windows server

#When successful is displayed, it means that the service has been installed successfully! We can click My Computer->Management->Services to see if this service exists. As shown in the picture, I can already see the service named workerman!

Graphical tutorial on deploying workerman to windows server

But at this time, browsing http://127.0.0.1:55151 still cannot be browsed normally, because we have not turned on the service yet. Next, click the start button in the upper left corner. After the service is started, you can browse http://127.0.0.1:55151 normally!

The above is the detailed content of Graphical tutorial on deploying workerman to windows server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete