|
|
|
|
|
by exikyut
1523 days ago
|
|
PHP seriously needs an event loop. The Node model, where things that call into libuv to wait on servers and such prevent the script from exiting, is simple enough to implement and while mildly unintuitive to newcomers is still accessible thanks to Node's popularity. |
|
PHP/Go/C# one-thread-per-HTTP-request also requires less cognitive load where everything is synchronous by default. Also PHP's throw-away-everything after each request tolerates much more junior-code abuse.
Forgot to close a database connection or transaction? No problem, PHP will do that for you. Left a file open? Forgot to close a CURL handle? No worriers the janitor is coming to clean your mess at the end of the request.
With that said, PHP does have an event loop. See ReactPHP and Swoole. They existed for years and while they have their uses, they aren't going to overtake "standard" PHP execution model anytime soon partly because of the reasons above.