Repository navigation
Description
#1686 switched all 8.6+ images to ZTS and dropped NTS builds entirely. I'd like to ask for this to be reconsidered, or at least softened, before 8.6.0 GA, because it appears to anticipate an upstream decision that hasn't been made yet.
Upstream status, as far as I can find:
- The only internals discussion is a pre-RFC from July 2026 ("Deprecating NTS and making ZTS the default build mode", https://externals.io/message/131870). It targets NTS removal for PHP 9.0, not 8.6.
- There is no RFC on wiki.php.net and no vote.
- In that thread, a core developer explicitly asked for proper benchmarks under different loads (FPM, Apache prefork) before accepting the "negligible overhead" claim, since performance is the main reason two build modes exist. I couldn't find those benchmarks published anywhere.
- [PHP 8.6] switch the default from NTS to ZTS #1673 mentions being told that no RFC is needed for build changes, but I couldn't find that statement in the public thread. If it exists, a link would help.
#1689 describes the change as "PHP upstream recommended that we switch the images to use ZTS by default". As far as I can tell, that recommendation came from the author of the pre-RFC in #1673, not from a decision of the PHP project: there is no accepted RFC, no vote, and no release-manager statement that I could find. If there is an official upstream statement I've missed, please link it and I'll gladly close this.
Why this matters for these images specifically:
For many users, php:<version>-cli / -fpm is PHP. Switching them to ZTS-only effectively makes ZTS the default for a large share of the ecosystem before upstream has decided to do so. It could also later be cited as evidence in that very RFC ("everyone already runs ZTS"). The images have historically followed upstream defaults (NTS by default, ZTS as an opt-in variant), and I think that is the right policy here too.
There are also practical concerns:
- NTS is still the upstream default build in 8.6, and it is what essentially every major distribution ships: Debian/Ubuntu, Alpine, Arch, Fedora/RHEL (ZTS is an off-by-default build conditional), FreeBSD ports (ZTS is an off-by-default option), and Homebrew (explicitly no thread-safe build). With remove zts, instead all images are always built as zts (8.6+) #1686, the 8.6 images become the only mainstream PHP source that is ZTS-only, so behavior in containers will diverge from what extensions and benchmarks are usually tested against.
- Overhead of ZTS for single-threaded CLI/FPM workloads is claimed to be small, but it hasn't been demonstrated with published, reproducible benchmarks.
- Some extensions and features still don't support ZTS (e.g.
--with-mmsession handler, some third-party/commercial extensions such as APM agents).
Request, in order of preference:
- For 8.6, keep the previous layout: NTS for
cli/fpm/apache, with ZTS available as the-ztsvariant. Revisit when an RFC is accepted upstream (most likely for 9.0, where the question resolves itself). - If that's not acceptable, at least publish
-ntsvariants for 8.6 so users have a supported migration path, and document the change prominently in the image description / release notes.
Thanks for maintaining these images. I'm not against ZTS as such. I'd just like the official images to follow upstream's decision rather than get ahead of it.
Refs: #1673, #1686, #1689, https://externals.io/message/131870
Activity
tianon commentedon Nov 19, 2026
cc @henderkes 🙇
FWIW, I've had a paperclip counter help write some benchmarks to chase various PHP threads, including ZTS overhead, and the results can be seen in the actions on https://github.com/infosiftr/php-bench
From https://github.com/infosiftr/php-bench/actions/runs/43888110981 (the latest report):
...
...
...
CPU: what does the thread-safe (zts) build cost? -- #742
henderkes commentedon Nov 19, 2026
The proposal to switch the Docker images ahead of time came from a php internals slack discussion - it didn't come from me. The idea being to get a grasp on what NTS-only features would actually need to be kept (mm session backend, chroot function, hard timeouts, signal handling, timeout handling). Most of these are half-broken that just haven't been removed yet.
I'm not necessarily against keeping NTS available for now, but I would like to hear the actual issues you're currently running into. 8.6 went into GA as of 2pm yesterday.
(Edit: The reason this is starting with the Docker images and not elsewhere is simple: the docker extension installer already had full ZTS support. For distributions it would've meant a larger change.)
henderkes commentedon Nov 20, 2026
These numbers look a lot like <= PHP-8.5 values. Are you sure they are from 8.6? There will still be overhead in the worst case scenarios, as the globals move didn't make it in before 8.6 was branched, but it shouldn't be anywhere near +19% in any case, even with recursive TLS reloading and the JIT still emitting a TLS load rather than direct access instruction (also merged in master).
tianon commentedon Nov 20, 2026
henderkes commentedon Nov 20, 2026
I copied the 8.6-cli dockerfile into a NTS variant and ran your suite:
https://github.com/henderkes/php-bench/actions/runs/44659928397
But I wouldn't put too much faith on the numbers being faithful due to CI runners unstable nature. <= 5% differences are hard to measure, even on mostly stable local hardware. The jit slowdowns are probably real, but anything other than that should be at <= 2% difference.
I'll run the numbers later on a stable cloud runner, but it's a 4 core machine so that'll take a while.
roxblnfk commentedon Nov 20, 2026
Thanks for the context and for running the suite on 8.6.
What we have already run into. We maintain Rapira, an application server by the RoadRunner maintainers. Rapira only works with NTS, and we relied on the NTS builds of the official images. With 8.6 those builds are gone, so we had to publish our own:
ghcr.io/rapira-rs/php:8.6-nts. For users, this means moving away from the official images to get the build that is still the default in PHP itself.What users will run into. The floating tags (
latest,8,fpm,8-fpm,apache,alpine, …) already point to 8.6, so the change of build mode arrives with a plaindocker pull, without any warning. The problems show up at runtime:chdir()only changes PHP's virtual CWD, so native code (FFI, libraries used by extensions) may see a different working directory;chroot) are core functionality for long-running workers;Where the decision was made. Could you clarify which "php internals slack" this was? If it's the PHP Foundation's Slack, I'd point out that the Foundation funds development but doesn't decide the direction of the project. Those decisions go through the internals list and the RFC process. @DanielEScherzer, @mbeccati, as the 8.6 release managers, were you part of that discussion, and do you support switching the official images to ZTS-only? #1689 currently describes this as "PHP upstream recommended…", and users read that as the position of the PHP project.
Proposal. Since 8.6 is GA now and you're not against keeping NTS available, could the images publish
-ntsvariants for 8.6 (mirroring the previous-ztsones)? Either way, a note in the Docker Hub description (docker-library/docs) would help: right now it doesn't mention anywhere that 8.6 is built as ZTS. The only explanation is the closed #1689, while users oflatest/fpmget the change through a regulardocker pull.henderkes commentedon Nov 20, 2026
As long as you use the CG/EG/SG/etc macros like php-src instead of relying on direct struct access, it should work perfectly fine with a ZTS build. But yeah, I can see that it may have broken your expected upgrade.
I think that's the biggest issue, but at least for php-src there's no forward compatibility promise between minor versions. E.g. 8.6 can (and will) have other breaking changes than the ZTS default.
Like I said, don't read too much into these. For one, because they're not representative of real world load, second, because the CI runners are very unreliable. :
My local run came in at an average 1.5% slowdown
Yes, the foundation slack, which isn't only used for foundation work, but also has community channels with plenty discussion about all sorts of non-official work. A ZTS switch suggestion doesn't constitute any php foundation involvement. There was no formal "decision".
Quoting myself from #1673:
I don't see a reason against it. Though it would be helpful if you could actually detail exact breakage that you're encountering if you attempt switching to ZTS. That's the largest reason for why it was even suggested: see what breaks while there's still a way to fix it. If nobody tests until NTS doesn't exist anymore, we'd have no idea until it was too late.
FYI, I'm absolutely planning on keeping hard-timeouts, maybe even the zend-mm backend. A ZTS-only build doesn't necessitate dropping that functionality, it would just have to restrict it to single-threaded SAPI usage (like CLI, FPM).
roxblnfk commentedon Nov 20, 2026
Thanks for the detailed reply and the local numbers.
On #1689, I'd point out an inaccuracy there: it describes the change as "PHP upstream recommended that we switch the images to use ZTS by default". By your account, this came from a discussion in a community channel of the Foundation's Slack, and "there was no formal 'decision'". So there was no upstream recommendation, only a suggestion by some contributors and a pre-RFC that never became an RFC.
On "see what breaks": the goal makes sense, but changing the default is a poor way to reach it. The opt-in
-ztstags existed for years, and they were the way to test ZTS. People whose setup breaks after adocker pullusually have no reason to come here and report it. They just pin 8.5 or move to other images, as we had to. So this is more likely to produce incomplete data than a real picture. Rapira's ZTS compatibility is a separate topic, and this issue is about the default of the official images. As for compatibility between minor versions: this change doesn't come from PHP 8.6. It's not in UPGRADING or in the image description, so users have no way to expect it.@tianon, @yosifkit, since there was no formal upstream decision, could 8.6 go back to the previous layout: NTS in
cli/fpm/apache, and ZTS as the-ztsvariant? 8.6.0 was released only yesterday, so a revert now affects far fewer users than it would later, once 8.6 has spread to production through the floating tags. The only consequence we know of is that downstream images that already switched toclias their ZTS base (for example FrankenPHP in itsdocker-bake.hcl) would need to switch back to-zts, a one-line change.If reverting the default isn't acceptable to you, then at least
-ntsvariants for 8.6, as the original proposal in #1673 already suggested. Either way, we're happy to help with a PR.UPD: besides ZTS itself, the 8.6 images come with two more behavior changes that aren't mentioned anywhere:
--disable-zend-signals. This flag used to be only in the-ztsvariant, while upstream has Zend Signals enabled by default.max_execution_time/set_time_limit()now measures wall-clock time (CLOCK_BOOTTIME) instead of CPU time (ITIMER_PROF). Time spent insleep()or waiting on a database, HTTP or a queue now counts, while before it didn't. The timeout signal is also different: a thread-directed SIGRTMIN instead of SIGPROF.To reproduce:
Both changes make sense for a ZTS build. But for users of
latest/fpm, it means that after a regulardocker pull, scripts with an explicit time limit that wait on I/O may start failing with a timeout without any change in their code.henderkes commentedon Nov 20, 2026
I don't mind your suggestion, but please understand that
clearly went without great effect. People use the default or get confused when put before a choice, especially one like NTS vs ZTS, where most information google will dig up is a decade old. That default was/is ZTS for FrankenPHP/parallel/Windows*/Apache users and NTS for Unix/RoadRunner/FPM/CLI.
I don't believe the default switch will/would affect most users in a noticeable way.
rustatian commentedon Nov 20, 2026
RoadRunner does not depend on PHP thread safety (you can use any PHP, zts or nts).
henderkes commentedon Nov 20, 2026
Yes, my understanding is that Roadrunner is based off cli, meaning it gets the unix default of non-apache/frankenphp, which is NTS. Generally no SAPI should depend on php being NTS internally (that's what the global accessor macros exist for).
roxblnfk commentedon Nov 20, 2026
Users do mostly go with the default, which is exactly why changing the default affects them. But NTS for FPM/CLI isn't a leftover from outdated search results. It's the project's current recommendation: 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. Users who need ZTS (FrankenPHP, parallel) already had
-ztsavailable.This issue isn't about SAPIs. It's about behavior that users of the image get without any change in their code. The example from the UPD above is a plain script:
set_time_limit(2); sleep(4);passes onphp:8.5-cliand fails with a fatal error onphp:8.6-cli, becausemax_execution_timenow measures wall-clock time instead of CPU time.xepozz commentedon Nov 20, 2026
Macros are fine (and I don't know why it is even a point), but they do not change how SAPI works (NTS or ZTS or both). Moreover, usually, if SAPI is not written in C/C++, you're using them from a shim layer, because in Rust or Go you can't use them directly.
I think that is the reason why these images were so quickly changed to ZTS.
henderkes commentedon Nov 20, 2026
No, switching the default doesn't directly benefit FrankenPHP. The immediate advantage is deduplication. There's thousands(+++) of build hours wasted every week because two versions of the same engine exist. It incurs extra work for every packager like Remi (RPM, who maintained two partial builds for a long time and still updates the old streams), Shivam (Homebrew/Windows) Michele (Docker extensions), countless others and myself. And, obviously, the Docker team here, who are also volunteering their work.
If you're asking why it's NTS that should go: they're 99% the same, except that one can handle multiple threads while the other can't.
rustatian commentedon Nov 20, 2026
While I completely agree that having 1 mode would be great, it doesn't solve the duplication problem in any way. You just made things more complicated for other SAPIs to use official PHP images by breaking them in a way that, for example, I, as a Rapira maintainer, can't use them anymore because they're ZTS-only now. For other people, that change will also very likely introduce surprises in their apps' behavior because of the reasons stated above.
So, my simple question is: what problem does that action actually solve?
28 remaining items
smirnov-e commentedon Nov 21, 2026
@tianon why not to drop default at all and keep only explicit ntz/zts variants with explanation that previous default is called -nts now? That way it could be measured without false assumptions.
Most users nowadays first wait for X.Y.1 or X.Y.2 patches with most critical bugfixes, so appealing to “some brave persons already use zts” is irrelevant.
roxblnfk commentedon Nov 21, 2026
+1 to @smirnov-e's suggestion. Only explicit
-nts/-ztstags with no default remove the magic: the build mode is visible right in a project's Dockerfile, and no future change of the default, in the images or in PHP itself, would catch anyone off guard. That's what we did for our own images:ghcr.io/rapira-rs/phpis published only with8.6-ntsand8.6-ztstags.But there are floating tags like
latest. IMO, for them it would be safer to point to 8.5 NTS or8.6-ntsthan to 8.6 ZTS: whoever pullslatestwould get a regular update within NTS, not a change of build mode they didn't know about.alcohol commentedon Nov 21, 2026
But they could have known about it if they did their due diligence, isn't that the whole point here? Rather than raising their pitchforks, this should be a reminder in that regard perhaps.
smirnov-e commentedon Nov 21, 2026
That means there is no problem to revert current behaviour, right? Doing due diligence must be applied to everyone in everyday basis, not only when it's convenient.
philipwhiuk commentedon Nov 21, 2026
Isn't the correct thing to do merely to reflect the PHP defaults? While this isn't an official image it's surely Docker's attempt to produce an image reflecting the intended upstream behaviour out the box as close as possible.
If PHP makes ZTS the default, then the image reflects it and the community decides if they need a legacy NTS image
If PHP keeps NTS as the default, then the image reflects it and the community decides if they need a ZTS image as well
PHP could change the default in 9 and remove it in 10 if they wanted to. That would be the reasonable mechanism to make a breaking change.
Talk of a 1-7% performance being minimal is kind of ridiculous - entire libraries are re-written to benefit from such performance differences. If you advertised PHP 8.6 as "now upto 7% slower" people would call it a blocking regression.
If the originator of this change is unable to persuade PHP to change the default then surely that's indicative of the state of ZTS.
SerafimArts commentedon Nov 21, 2026
Let’s just define
tsandntsexplicitly, as @roxblnfk and @smirnov-e suggested. That will resolve absolutely all issues and questions.henderkes commentedon Nov 22, 2026
@rustatian
Not written down anywhere, but in discussion internally. The process is:
No, a RFC has not been formally submitted, because it's not time for it yet. As I was explained, in my own understanding, changes to the build system do not have to go through the RFC process if they do not incur a userland change.
What this means is that if ZTS were to keep
--with-mm, hard timeouts and other things currently limited to the NTS build, no RFC would be strictly necessary, albeit still a good idea. If (any of) these things were to be removed, they would need to go through individual RFCs.The question whether it's worth writing RFCs to remove them depends on user feedback to see how many even rely on that functionality. So far, no mm session backend users have raised their hand. we only had one report relying on hard timeouts (that being by you, rapira maintainers, which wouldn't actually be covered by BC promises in SAPI or internal land anyhow) and none for the other things.
A few other things have been raised, but they're either broken, or do not actually relate to thread safety. Examples are:
This is governed solely by
--enable-zend-max-execution-timers. You can disable or enable them no matter the thread safety setting, it's just that ZTS has the sane default. Whatever 8.3 has to do with that anyways, since we're talking about a removal in 9.0. And again, what signal is used or not has never been under any sort of BC umbrella.dl()is again unrelated to thread safety. Its availability depends on the SAPI being compiled. And I don't understand why ABI compatibility is mentioned yet again, because that was once again never under any BC. You can't load a 8.6-NTS extension on 8.5-NTS any more than you can load a 8.6-ZTS extension.For the broken one:
Unrelated to NTS and ZTS, governed by
--disable-zend-signals. And it doesn't actually govern signal handling, it governs intern signal deferral in PHP during critical sections. It's pretty broken in NTS anyhow and its only use left is in opcache - and it's currently intended to be removed altogether. Your server doesn't rely on the setting at all.Let's see to other problems mentioned that do relate to thread safety, but not to PHP's internal thread safety model:
For the last one I'd actually liked to say that other than the broken and unbundled ext-imap extension, to my knowledge all libraries currently used by PHP and its common extensions are thread safe. And New Relic has ZTS in beta and every other APM is fully ZTS compatible. And that again relates to ABI, like I must have mentioned ten times by now.
The misconception here is that these relate to thread safety. But they are not. They're governed by whether the SAPI spawns multiple threads and/or reuses them.
Now on to some of the other things mentioned...
Write bad code making ungoverned internal assumptions, get bad results.
I do not recommend anyone to actually use
chroot. Its availability is only guaranteed in embed NTS anyhow. I would be shocked if anyone actually allowed that function to be used... and it's not actually related to PHPs internal thread safety again.That's the PHP 8.6 access and no longer true in 8.7. And again, virtually all extensions are ZTS compatible.
It's not a 1-7% performance loss, it's 0-7% (in 8.6) in very specialised scenarios that do not translate in the same way to real world usage. I wouldn't be making plans to remove NTS if there weren't a way to essentially eliminate the current performance penalties.
Not to mention, but even if it's 1-2%, that hardly impacts real-world usage. Docker images and system packages all use very conservative compilation options while more aggressive compilation options on new compilers could provide more than 10% extra performance. GCC still defaults to the hybrid VM and Clang just got a 30%ish performance boost in 8.5 thanks to Arnaud. Windows still ships with MSVC instead of Clang builds that I ported which are 70-150% faster. Everyone is fine with that, but not with the current thread safety overhead for one version?
I do understand everyones frustration here. But the onslaught of (I assume LLM generated, or poorly researched) potential issues mentioned here doesn't help. The switch was done in advance before 8.6 even entered the RC phase. Half the issues mentioned would've happened in 8.6 NTS too because ABI isn't guarded between minor versions. Everyone complaining about the lack of communication may be technically right, but forgets that there's no actual communication channel that changes are about to come outside of... well, what happens in these images, and php internals.
What also doesn't help are the personal insults or misrepresentations of what happened. And I once again implore every actual PHP user to write their actual issues in userland php down here, so we can at least get something positive out of this thread. If you don't want to do it for us, just do it for yourself and protect yourself from eventually seeing some ancient NTS-only functionality removed in the future, even if you don't follow the RFC process or have no voting rights.
Sorry to @tianon and @yosifkit for having to deal with this pile of a thread.
No slop machine has been tickled in the writing of this response. I do not claim correctness on all issues, because it took long enough to write resposes from mostly just memory. I am not a core PHP developer, this does not constitute an official response.
TuzelKO commentedon Nov 22, 2026
Simply put, are you confirming that ZTS is not finished and does not meet the criteria for a drop-in replacement? If so, why is it being pushed as the default?
So you confirm that the decision to migrate to ZTS as the "default" was not officially adopted.
You are attempting to dismiss well-founded criticism. People are trying to explain to you that this change disrupts the supply chain, introduces non-obvious container behavior, causes confusion, breaks compatibility, and leads to a performance degradation (regardless of whether it’s 0–7% or 1–2%). You refuse to engage with these arguments, choosing instead to stir up controversy. You even allege that insults were made—insults that never actually occurred. Simply put, you are being manipulative. As a developer using an "official" image, I do not want to have to audit the entire supply chain; when I request such an image, I expect to be certain that it has been built in accordance with upstream recommendations. Forgive me if this "insults" you, but I have better things to do than track every experiment taking place in a Docker library repository. If a given image does not align with upstream recommendations—and if it alters established standards following nothing more than a "Slack discussion" and an RFC draft—then it cannot be called "official"; it should be labeled as "custom."
This response was prepared using Google Translate, not an LLM.
P.S. What causes frustration is the refusal to listen to the community’s feedback, coupled with endless attempts to make excuses. If such a reaction has emerged, it’s a clear red flag that something was handled incorrectly. As @Girgias noted—regarding the claim that the reaction wasn’t "strong enough"—it’s worth keeping in mind that this took place in the Docker Library repository, not the upstream project. Hardly anyone ever checks this space; as I mentioned earlier, people have more pressing priorities than verifying the "official" supply chain.
rustatian commentedon Nov 22, 2026
@henderkes
Thank you for the detailed explanation 👍🏻
Honestly speaking, I'm kinda glad that the discussion about removing NTS was at least started, and thank you for doing that 😃 Sorry if my words insulted you or anyone here, my intentions were positive.
Rapira was ZTS (and our Windows build is ZTS) + NTS (single-threaded) initially, but I switched to NTS only because of the performance problems I had and because no distro actually provides ZTS PHP builds in their packaging system. I don't remember the actual numbers, but that was something around 5-10% (for 8.5). And I'll update it to use ZTS now, since this is the future.
For me personally, I have all the answers I need. I already created our own images, since this is trivial, and a plan to resurrect ZTS. Since Rapira is 0.x, that situation does not hit me personally in any way, except for 5 minutes of frustration when switching the image 😄.
SerafimArts commentedon Nov 22, 2026
Could you please tell me how to write good code?
Just for the record, I should mention that I wrote about this unfixable ZTS bug 6 years ago (https://bugs.php.net/bug.php?id=79439), and it is precisely this issue that led to the inclusion of that note in the documentation (php/doc-en#121).
Please provide an example of the good code how to specify the directory from which a library should load its dependencies when using a ZTS build.
smirnov-e commentedon Nov 22, 2026
@henderkes
The right place to get feedback is your own FrankenPHP community, not everyone else. For starters change max_executiuon_time behavior to NTS for FrankenPHP users and collect feedback any time necessary.
Then it was pretty much stupid to try gather feedback here. You have plenty FrankenPHP users to test on, without damaging other's reputation.
Compare your behavior with nicolas-grekas php/php-src#25499
Try reading documentation, it clearly says
On non Windows systems, the maximum execution time is not affected by system calls, stream operations etc.. This default change must be reflected in PHP release notes, not dug up in Dockerfile's diffs.Because extensions are part of ecosystem and, for example, for us absence of New Relic is enough to say No to ZTS.
Let me remind you that ZTS support was once removed 4 years ago.
Reasons:
Enabling Zend Thread Safety (ZTS) was a massive undertakingandIt was an extra-large effortsrcTimeline
Looks like they doesn't have enough clients again and ZTS build may be dropped any time again.
Then stop insulting others:
Write bad code making ungoverned internal assumptions, get bad results.But the onslaught of (I assume LLM generated, or poorly researched) potential issues.Without accepted RFC such claims are obvious lies. Stop spewing LLM generated slop.
List them, please, point by point. Maybe I overlooked something, but I don't see any.
As of now at least 2 PHP applications servers build their own NTS images and much more people will build them in private due to security team concerns.
You may claim deduplication goal as achieved ))
We know that «Official Docker Images for PHP» are no longer trustworthy and reliable.
henderkes commentedon Nov 22, 2026
I'll give you the benefit of the doubt for being serious about this, so I'll try to answer the question before leaving this thread for good, since clearly not much productive has happened here other than from @rustatian.
For one, even if it isn't what you'd like to hear, PHP makes no promises to the regards of how stdlib methods function internally. Just because a method shares a libc function name doesn't mean that it actually calls the libc function, so
chdir()followed by FFI loading a shared library was never promised behaviour. Not that a realchdirwould resolve the loaded libraries dependencies against the CWD either, as far as I know.Second of all, it's not impossible to solve this not-a-bug. Unix lets processes and libraries define a search callback for loading of shared libraries that we could hook, resolve against the current threads id, and get the cwd from there. https://linux.die.net/man/7/rtld-audit
Windows likewise has LoadLibraryFlagsEx or whatever it was called that let you pass paths to resolve against.
Whether it's worth it? Certainly not to me, but feel free to create a PR. It wouldn't count as a bugfix, I mean it's not even functionality currently present in NTS, so only 8.7, but if it's important to you, feel more than welcome to.
However, using FFI, be it in NTS or ZTS, is almost exclusively a bad idea either way. It's nearly impossible to actually make it safe with exception handling and vm bailout logic as is.
If you really want functionality to load shared libraries resolved against cwd in ZTS builds today, you can also write a little helper that (recursively) checks the library you want to load for dependencies and builds the correct load-order.
Yoskaldyr commentedon Nov 22, 2026
I guess someone forgot to tell the PHP developers that adding FFI support to PHP was almost exclusively a bad idea.
Perhaps we should just remove FFI from PHP instead of fixing compatibility issues?
P.S. The more you explain why users shouldn't rely on existing PHP functionality, the better you demonstrate why they shouldn't rely on these Docker images either.
SerafimArts commentedon Nov 22, 2026
To begin with, I was branded a bad developer ("Write bad code making ungoverned internal assumptions, get bad results") - my qualifications were called into question, and I was told that, instead of just using a simple
chdir, I should write something like this (and fix "ZTS feature" using FFI): https://github.com/php-ffi/work-directory/blob/master/src/Driver/WindowsThreadSafeDriver.phpThen I was advised to drop FFI entirely, simply because "It's nearly impossible to actually make it safe with exception handling and vm bailout logic as is" (though why would anyone even try to make something safe when it’s meant to be low-level, efficient, and inherently unsafe?) - and all without offering any alternatives.
...
Thanks, I understand your arguments. I think we can end the conversation here =)
Honestly, it might be easier to just give up on PHP altogether - after all, it has "unsafe exceptions".
NathanFreeman commentedon Nov 23, 2026
As a Swoole maintainer, I would like to share a practical architectural limitation we encountered while adapting to ZTS. In SWOOLE_PROCESS mode, the master process's event loop relies heavily on the multi-reactor threading mechanism to dispatch I/O events. Constrained by the current thread-safety mechanisms of ZTS, and to ensure runtime stability, we are forced to restrict reactor_num to 1 in the master process.
While this does not affect the fundamental operation of Swoole, it is indeed a functional compromise for users who rely on the multi-reactor architecture to handle high-concurrency connections. This is also a major reason why the official Swoole Docker images currently continue to recommend the NTS version by default.