Explain the difference between Thread Safe (TS) and Non-Thread Safe (NTS) versions of PHP.

Last updated 15 June 2026

  • 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_php with 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.

  • https://www.reddit.com/r/PHP/comments/1p6bprs/why_dont_major_companies_invest_in_phps_evolution/
  • https://www.reddit.com/r/PHP/comments/1bp7tfh/what_is_the_future_of_php/
All PHP interview questions