Home > Article > Backend Development > How to obtain unclosed socket resources in php? ?
After creating $socket = socket_create -> socket_bind -> socket_listen, the $socket resource is not closed.
When I reopen this page, how can I use the $socket resource created last time? ?
After creating $socket = socket_create -> socket_bind -> socket_listen, the $socket resource is not closed.
When I reopen this page, how can I use the $socket resource created last time? ?
If you are in an fpm environment, then I can tell you that it is impossible. This kind of resource will be released uniformly after the end of a request.
If you want to maintain a persistent connection in php, you need to have a cli Start long-running environment