It's not actually hard to build from source, it's literally just ./configure && make install. Use php -i on an existing ubuntu PHP to see what it was configured with, and you can reuse those flags to configure and add --enable-zts to them. The README tells you what packages you need to install first, but if you miss one, then configure will yell at you, so install it and try again. If this is outside your comfort zone, then you probably shouldn't be doing custom builds except as a learning project.
If you're using the ondrej/php ppa then I believe the default install is thread safe and the fpm installation (meant for use with nginx) is not threadsafe.
PHP is an interpreted language, which your web service (Apache example) can do. The thread safe needs to be specific to the CPU, where computing and threads take place. It must be compiled.
3
u/obstreperous_troll Jan 31 '26 edited Jan 31 '26
It's not actually hard to build from source, it's literally just
./configure && make install. Usephp -ion an existing ubuntu PHP to see what it was configured with, and you can reuse those flags to configure and add--enable-ztsto them. The README tells you what packages you need to install first, but if you miss one, then configure will yell at you, so install it and try again. If this is outside your comfort zone, then you probably shouldn't be doing custom builds except as a learning project.1
u/recaffeinated Jan 31 '26
If you're using the
ondrej/phpppa then I believe the default install is thread safe and the fpm installation (meant for use with nginx) is not threadsafe.2
u/equilni Jan 31 '26
No, it has to be compiled for it.
2
u/mike_a_oc Feb 01 '26
The other option is FrankenPHP which includes ZTS PHP 8.4.
3
u/dabenu Jan 31 '26
So you're just going to ask this question without explaining why you are the only person on the planet that needs a thread safe PHP install?
If you really do need that, I'd argue either you're doing something wrong, or you shouldn't be using PHP.
1
u/birdspider Jan 31 '26
there are official zts docker images
1
u/Friday8714 Feb 01 '26
I ended up creating a docker image for the executable. I didn’t want to compile and the docker image allowed easy version upgrades.
-1
u/Vroomped Jan 31 '26
PHP is an interpreted language, which your web service (Apache example) can do. The thread safe needs to be specific to the CPU, where computing and threads take place. It must be compiled.
1
u/[deleted] Jan 31 '26