I think the title is clear.
While you can't spawn threads from PHP code you can use PHP with a multi-threaded web server that handles concurrent requests on different threads. In this case the TS (thread-safe) version of PHP should be used.
The TS version of PHP keeps the state of each request in its own memory location. This is necessary because all requests in a multi-threaded server share the same address space.
The alternative is to use a multi-process (usually prefork) server. With such a server some state can be kept in global variables without affecting concurrent requests. That's how the NTS (non thread-safe) version of PHP is implemented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With