← Back to PHP Tutorial

PHP for Windows: VS17 x64 Thread Safe or Non Thread Safe?

When downloading PHP for Windows, decide by server mode: Apache module usually needs Thread Safe; IIS/FastCGI, CLI, Composer, and local development usually use Non Thread Safe.

Direct Answer

VS17 means the build uses the Visual Studio 2022 runtime, x64 means 64-bit, and Thread Safe versus Non Thread Safe depends on how PHP is loaded. For a normal 64-bit Windows dev machine, CLI, Composer, IIS, or FastCGI, choose VS17 x64 Non Thread Safe.

What do the labels mean?

VS17

Built with the Visual Studio 2022 C/C++ runtime. Install the matching Microsoft Visual C++ Redistributable if needed.

x64

The 64-bit build. Modern Windows development and server machines should normally use x64.

Thread Safe

Use it when PHP is loaded directly into a multithreaded web server, such as Apache mod_php on Windows.

Non Thread Safe

Use it for FastCGI, IIS, command-line scripts, Composer, local development, and PHP-CGI/PHP-FPM-like deployments.

Decision table

ScenarioChooseWhy
Apache module/mod_php on WindowsThread SafePHP is loaded inside a multithreaded web server.
IIS/FastCGI or PHP-CGINon Thread SafeFastCGI runs isolated worker processes.
CLI, Composer, local scriptsNon Thread SafeCommand-line PHP runs as a separate process.
64-bit Windowsx64Matches the OS architecture and common extension builds.

Inspect your current build

php -v
php -i | findstr /i "Thread Architecture Compiler"

If the output contains NTS, it is Non Thread Safe. If it says Thread Safety enabled, it is a Thread Safe build. PHP extensions must match the PHP version, compiler family, architecture, and TS/NTS mode.

Where this fits in setup

For a normal development environment, start with PHP environment setup, download VS17 x64 Non Thread Safe for Windows manual installs, and add the extracted PHP directory to PATH.