Repository navigation
Conversation
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"
|
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. |
|
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. |
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 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" |
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. |
|
The only things I see from that issue seem to mainly be FUD and pure vitriol:
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. |
|
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. |
|
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. |
|
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? |
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. |
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. |
@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. |
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, 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 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. |
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.
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.
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. |
8.6
cliis ZTS-only, so addztsalias tags to it and a newntsvariant (8.6 only) that builds the non-ZTS version again -- thentspin lives in one place inversions.sh, andztsaliases are only emitted when a version hasntsbut noztsvariant, so 8.7+ drops both naturally (with an easy single place to decide otherwise later).The
ntsvariant 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(...)toIN(x; ...)in the template andversions.shwhile touching them.Assisted-By: "claude my eyes right out"
See #1719 (comment)
Closes #1719
Closes #1721