Home > Article > Backend Development > Looking for php blocking function
There is such a requirement that a.php cannot end after execution is completed and needs to be blocked there. Then b.php communicates with the outside and passes the data from the outside to the blocking a.php.
Then it is best not to use socket to block the network.
It is recommended not to do this. You use a parameter in a.php to identify it, for example:
Visit first a.php?type=0;
Then visit b.php;
Finally, visit a.php?type=1;
What you want is impossible to achieve!
What you want is impossible to achieve!
Ask the moderator for help. . Why can't this requirement be realized?
The moderator is right. Since a is blocked, how can it perform the receiving action?
a can only perform monitoring actions, not blocking
The moderator is right. Since a is blocked, how can it perform the receiving action?
a can only perform monitoring actions, not blocking
Okay. Maybe I didn't make it clear originally. Is it the kind of blocking that is in a listening state?
In an http session, php appears as a worker program of the http server.
If php is suspended, the http server will not terminate this round of session because there is no return.
Since the http protocol is a stateless protocol, the session cannot be re-entrant. (Want to chime in, but don't know where to chime in)
I'm guessing you plan to do server push.
Since this kind of application is closely related to the browser, it is not currently supported by php (of course some server-side languages have begun to support it)
The php applications you can see need to use socket as the server. And you don't want to do that
In the http session, php appears as the worker program of the http server.
If php is suspended, the http server will not terminate this round of session because there is no return.
Since the http protocol is a stateless protocol, the session cannot be re-entrant. (Want to chime in, but don't know where to chime in)
I'm guessing you plan to do server push.
Since this kind of application is closely related to the browser, it is not currently supported by php (of course some server-side languages have begun to support it)
Yes...
Then ask the moderator weakly. Isn't it possible to use pcntl or popen for inter-process communication and blocking?
It’s just that pcntl seems a bit unstable on the web. popen feels like it has too much authority and is a bit dangerous.
So are you planning to modify the php kernel or the apache kernel?
If you have this ability, it's no problem
So are you planning to modify the php kernel or the apache kernel?
If you have this ability, it’s no problem
It seems that it should only be socket, thank you moderator