Explain the difference between Thread Safe (TS) and Non-Thread Safe (NTS) versions of PHP.
Last updated
Thread Safe (TS) builds use ZTS (Zend Thread Safety) locking so multiple PHP threads can share one process. They are needed for threaded SAPIs like Apache
mod_phpwith a threaded MPM, but are slightly slower.Non-Thread Safe (NTS) builds skip locking because each request runs in its own process. They are faster and the right choice for PHP-FPM and CLI.
Default to NTS for modern Nginx + FPM stacks, and match extensions to the build you choose.