Reply content:
Multithreading may not be reliable. PHP was not designed for multithreaded environments from the start, so the pthread extension would need to go deep into the PHP kernel and do very complex hack programming. Program A complex problem comes, there will certainly be a lot of bugs.
The socket is unreliable, look at people. The socket series function provided by PHP is the encapsulation of the operating system socket interface, very low level.
So for the socket function provided by PHP, if the developer is reliable, the naturally written program will be reliable. Developers who do not understand what is a socket, naturally written out of the program is not reliable.
You can learn about PHP's swoole extension, http://www. swoole.com/ PHP multithreading is generally used php:pthreads
extension, I actually used this extension, the extension in the use of the process will have some problems, such as coredump, so it is not recommended to use
PHP socket use to no problem, the performance is good, after all, C is the simple package. And there's a lot of open source PHP sockets on GitHub.
For example:
Reactphp/react GitHub
Kakserpom/phpdaemon GitHub
Walkor/workerman GitHub
They are all based on PHP multi-process + PHP socket + Epoll and other multi-channel IO multiplexing