문제

I'm trying to set up a "server" script in PHP, which should run for a limited amount of time in the background. But multiple instances of this script may run at the same time. Unfortunately fsockopen() doesn't let me use the same port at the same time by two different scripts, so others fail in error :(

Is there any way around this?

도움이 되었습니까?

해결책 2

PHP doesnot support multi-threading, but there are alternatives to it, not the best but in slang word- "workable".

And to listen on specific port using php, Use socket_listen, socket_bind, socket_create, etc., functions of php, you may have a look on stream_select functions too... if that helps.

Recommended page Parallel processing in PHP

다른 팁

fsockopen is for client socket and you cannot start a server to listen on specific port with fsockopen

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top