Skip to content

Add 8.6 "nts" variant and "zts" aliases for "cli" - #1722

Open
tianon wants to merge 1 commit into
docker-library:masterfrom
infosiftr:8.6-nts
Open

tianon wants to merge 1 commit into
docker-library:masterfrom
infosiftr:8.6-nts

Conversation

@tianon

@tianon tianon commented Nov 21, 2026

Copy link
Copy Markdown
Member

8.6 cli is ZTS-only, so add zts alias tags to it and a new nts variant (8.6 only) that builds the non-ZTS version again -- the nts pin lives in one place in versions.sh, and zts aliases are only emitted when a version has nts but no zts variant, so 8.7+ drops both naturally (with an easy single place to decide otherwise later).

The nts variant intentionally skips --enable-embed: it is meant to be minimal and quick to build, and the places embed is most useful ought to be using ZTS anyhow.

Also convert x | IN(...) to IN(x; ...) in the template and versions.sh while touching them.

Assisted-By: "claude my eyes right out"

See #1719 (comment)
Closes #1719
Closes #1721

8.6 `cli` is ZTS-only, so add `zts` alias tags to it and a new `nts` variant (8.6 only) that builds the non-ZTS version again -- the `nts` pin lives in one place in `versions.sh`, and `zts` aliases are only emitted when a version has `nts` but no `zts` variant, so 8.7+ drops both naturally (with an easy single place to decide otherwise later).

The `nts` variant intentionally skips `--enable-embed`: it is meant to be minimal and quick to build, and the places embed is most useful ought to be using ZTS anyhow.

Also convert `x | IN(...)` to `IN(x; ...)` in the template and `versions.sh` while touching them.

Assisted-By: "claude my eyes right out"
@TuzelKO

TuzelKO commented Nov 21, 2026

Copy link
Copy Markdown

It seems the core of the problem hasn't been grasped. ZTS should not be the default. Pushing it as the default configuration will cause issues for many users who aren't "in the know," and they won't understand why. ZTS should only be made the default once the upstream PHP development team recommends doing so.

@Girgias

Girgias commented Nov 21, 2026 •

Copy link
Copy Markdown

As a maintainer of PHP I would love to see when the project ever recommended NTS over ZTS. As I've never seen such a recommendation.

ZTS has been a core part of PHP for well over a decade, existing in some shape since PHP 5, and any extension maintainers really ought to have it work regardless of the mode PHP was built with. It is a requirement for Windows builds, some SAPIs, and various extensions (e.g. ext/parallel).

And frankly rather than having nebulous statement that this 'will cause issues for many users who aren't "in the know," and they won't understand why' it would be more useful to known what actual issues are encountered in a ZTS build that are not encountered in an NTS build. As from our perspective ZTS or NTS should be an invisible change to userland.

So unless the people that are up in arms about this change can show some actual and tangible issues that are caused by the flip from NTS to ZTS, the default being either one seems very much like a non-issue. Continuing to offer explicit NTS and ZTS builds might make sense, but this is something for the Docker maintainers to decide.

@SerafimArts

SerafimArts commented Nov 21, 2026 •

Copy link
Copy Markdown

And frankly rather than having nebulous statement that this 'will cause issues for many users who aren't "in the know," and they won't understand why' it would be more useful to known what actual issues are encountered in a ZTS build that are not encountered in an NTS build. As from our perspective ZTS or NTS should be an invisible change to userland.

For me personally: ZTS provides no way to get the current executor_globals or access the rest of the execution context from the outside. So FFI is currently unusable for this purpose (although, for example, Stogov added fastcall support in 7.4 precisely for this case at Lisachenko's request, as I recall). The only workaround is to do an exhaustive scan of the entire array inside TSRM to identify the right “thread” based on a signature, for example, by writing a temporary variable 0xDEAD_BEEF from PHP and then searching for it from the outside. If the signatures match, you then assume that the array in question is the one you’re looking for - i.e., you find the required thread ID by trial and error.

I think the absence of this API was one of the reasons why many extensions and servers, including Rapira, completely abandoned ZTS.

P.S. Some of my PHP code in production (for example, memory realtime profilers) also relies on these limitations, which is why it only works in NTS mode. Unfortunately, running it in ZTS mode is impossible or at least, it would require some sort of "brute-force hack"

@TuzelKO

TuzelKO commented Nov 21, 2026

Copy link
Copy Markdown

So unless the people that are up in arms about this change can show some actual and tangible issues that are caused by the flip from NTS to ZTS, the default being either one seems very much like a non-issue.

In issue #1719, a number of problems were raised. Specifically, the issue that affects me is that the transition to ZTS (Zend Thread Safety) breaks proprietary extensions used at the company where I work—extensions that cannot be rebuilt because we do not have access to their source code.

@Girgias

Girgias commented Nov 21, 2026

Copy link
Copy Markdown

The only things I see from that issue seem to mainly be FUD and pure vitriol:

  • chroot: is not even available on most platforms and I would imagine hosts disable that function completely
  • prebuilt NTS extension, any extension needs to be rebuilt for a new minor PHP version anyway, and I don't know of any APM extension which doesn't run on ZTS
  • Zend signals: is something that has been in discussion to be removed for years as it causes issues for SAPIs that use NTS
  • Timers: depend on a build configuration and/or the OS
  • Rapira: which is a SAPI that I'm hearing for the first time that doesn't support ZTS for reasons that seem definitely fixable
  • Performance, which is effectively a non-issue as major work has been done to eliminate most of the difference.

And then you are saying there are proprietary extensions that don't support ZTS, which ones? Because it would be useful information to know.

It would be nice that users/libraries/projects/SAPIs that do funky things with PHP would actually report missing engine APIs or hurdles to integrate php-src in ZTS mode to the project itself rather than trying to do brittle hacks via FFI or just ignoring it and now being up in arms that it broke everything.

@SerafimArts

SerafimArts commented Nov 21, 2026 •

Copy link
Copy Markdown

You're absolutely right that issues and PRs should be reported rather than simply ignoring the TS build.

Personally, though, I’ve long considered the TS version obsolete for the last ~10-15 years, since Apache ~2.4 with mod_php, which required ZTS, was long ago replaced by more modern solutions (php-fpm -> RoadRunner, Swoole, Rapira, etc.).

In other words, the entire modern ecosystem (roughly 90% of it) is geared toward the NTS build, which is why ZTS was simply ignored.

Consequently, all that “pure vitriol” was probably triggered by the decision to use an obsolete build as the primary one.

@Girgias

Girgias commented Nov 21, 2026

Copy link
Copy Markdown

ZTS being "obsolete" is a completely ridiculous statement, it never was, nor ever has been. I'm well aware that not everyone uses ext/parallel or its predecessor ext/pthreads, but considering Swoole does require ZTS and was very much in the hype cycle for quite a few years it seems very strange to just ignore one way how PHP builds.

That userland doesn't know the difference nor thinks about it is one thing, but maintainers of extensions and projects that integrate into the engine ignoring it is quite frankly on them.

@TuzelKO

TuzelKO commented Nov 21, 2026 •

Copy link
Copy Markdown

Let’s have a straightforward discussion. Why is ZTS needed as the primary image? What is the main reason for the switch?

UPD: The community’s reaction suggests that this isn’t needed. Why push for it?

UPD2: Is this being done in favor of FrankenPHP?

@TimWolla

Copy link
Copy Markdown
Contributor

In other words, the entire modern ecosystem (roughly 90% of it) is geared toward the NTS build, which is why ZTS was simply ignored.

The CI in php-src would like a word: The majority of builds there are ZTS builds (including the main ASAN debug build, the PPC64 build, the Musl build, and the 32-bit x86 build). The NTS builds are an NTS release build, macOS and FreeBSD. Core PHP is much more extensively tested using ZTS than it is using NTS.

@TuzelKO

TuzelKO commented Nov 21, 2026

Copy link
Copy Markdown

Core PHP is much more extensively tested using ZTS than it is using NTS.

Because it’s buggier?

You are being asked about the fact that this change runs counter to the ecosystem—not about whether ZTS is undergoing more intensive testing.

@roxblnfk

roxblnfk commented Nov 21, 2026 •

Copy link
Copy Markdown

As a maintainer of PHP I would love to see when the project ever recommended NTS over ZTS. As I've never seen such a recommendation.

@Girgias, regarding a recommendation of NTS: windows.php.net says that "NTS builds are for single-threaded use cases, typically PHP running via FastCGI or on the CLI", while TS builds are for PHP loaded as a web server module.

@TimWolla, php-src CI tests the engine, it doesn't reflect what users run. The ASAN debug build has used ZTS since 2019 (php/php-src@54dd762f5), because a debug ZTS build catches more global-state bugs. That's good testing practice, but it says nothing about production: distributions still ship NTS.

@SerafimArts

Copy link
Copy Markdown

but considering Swoole does require ZTS

Hmmm... Nope o_0

Swoole never required a ZTS build. If I'm not mistaken, Swoole only recently started requiring a ZTS build, in v6, and only for native threads to work.

The only thing that really needed that build was mod_php in Apache. And pthread very often crashed with errors and was abandoned around the same time, around PHP 5 (https://www.php.net/manual/en/book.pthreads.php).

Speaking of parallel... it appeared at a time when the vast majority had already moved away from Apache and were using NTS builds, and all concurrency solutions were already being handled with forks and queues (or, as a last resort, amphp/parallel, which does not require a ZTS build).

So yes, in modern realities (the PHP 7 and 8 era), ZTS was practically in little demand - only for those who, for some reason, abandoned the more convenient Symfony/Laravel frameworks (fork/queue-based parallelism) in favor of ext-parallel.

Personally, I support moving away from various TS/NTS builds entirely. But the "sudden resurrection" of the ZTS build came as a huge surprise to me, too.

@Girgias

Girgias commented Nov 21, 2026

Copy link
Copy Markdown

Let’s have a straightforward discussion. Why is ZTS needed as the primary image? What is the main reason for the switch?

And yet you refuse to give any hint to what is the actual extension blocking you from using ZTS. Because knowing what extension it is could give dome php-src maintainers the opportunity to help said extension to support ZTS. Instead you seem dead set that this is some wide conspiracy.
But primarily maintaining 20 different configurations with subtle differences is a massive maintenance headache and ZTS supports more use cases then NTS, so it being the only one in the future is the only thing that makes sense.

UPD: The community’s reaction suggests that this isn’t needed. Why push for it?

And the community reaction of whom? People up-voting one issue on GitHub? One post on Twitter that has barely any traction? Especially when the topic is primarily about reinstating NTS builds? Which sorry to say, is not a representative sample of the community. This is not a topic of discussion at all in quite a few other places I looked.

UPD2: Is this being done in favor of FrankenPHP?

No, but if you want to see a conspiracy everywhere you go, please feel free to believe this, but then I see no point in continuing to engage with you. Especially as you seem to just want to belittle everyone and the project as a way to justify your behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reconsider ZTS-only builds for 8.6 until upstream PHP has actually decided

7 participants