Php: Request for php-fpm-zts

Created on 4 Jul 2016  路  13Comments  路  Source: docker-library/php

What are the chances of getting an official php-fpm-zts container for those of us who want to use pthreads with php-fpm + nginx?

I could always go build my own, but I like to use official containers wherever possible. Thoughts?

Thank you,
Ethan

Most helpful comment

How about a case where you run Symfony app on a php-fpm container and want to use threads for Symfony commands which run in CLI?
php-fpm-zts container would be useful for this.

All 13 comments

After creating my own image, I realized that this does not make much sense.

Closing.

Hi SmoshySmosh, I'm in the exact same place. Why does it not makes sense to have a php-fpm-zts container ?

@MelwinKfr I was wanting to use pthreads through php-fpm but once I built my own container to do so, I realized that pthreads only works in CLI mode which was not the context that I needed it in.

SAPI Support

pthreads v3 is restricted to operating in CLI only: I have spent many years trying to explain that threads in a web server just don't make sense, after 1,111 commits to pthreads I have realised that, my advice is going unheeded.

So I'm promoting the advice to hard and fast fact: you can't use pthreads safely and sensibly anywhere but CLI.

Thanks for listening ;)

@SmoshySmosh :heart: :heart: :heart:!

For the curious, source for that quote is: https://github.com/krakjoe/pthreads#sapi-support
(https://github.com/krakjoe/pthreads/blob/9bb5d038ab7cb6ef366320df8778b3195ace7619/README.md#sapi-support)

Okay I see, thank you for the hints !

How about a case where you run Symfony app on a php-fpm container and want to use threads for Symfony commands which run in CLI?
php-fpm-zts container would be useful for this.

I'd like an renewed look at this from the php team. @j4r3kb seems to have the same usecase as us in mind. We are currently building an Zend application with the same situation. We also have CLI command that want to utilize the ZTS version.

@rvdlee-salesupply

I know my version is quite a bit old, but you can test your theories against my php-fpm-zts container if you'd like. I can't find my original Dockerfile at the moment, but I will look for it more tomorrow and see if I can provide that for you too.

https://hub.docker.com/r/smoshysmosh/php-fpm-zts

@SmoshySmosh I've done something alike already. It would be nice if you could drum up your dockerfile :) It wasn't difficult to get NTS and ZTS running next to each other. The nice thing about the official php images is that they are a solid foundation to work from to make whatever image you need. I've standardized the process to create our production images.

Getting the exact same versions to run along each other proves to be a challenge. Alpine repositories in Edge only seem to support the last two versions. This proves to be a problem when you want to start with version pinning; which APK supports apk add php=7.2.11-r0 for example. Two months from now the repositories will have been updated with new versions. This would be a hassle in the sense that whenever I want to deploy a new ZTS+(NTS+FPM) image, the versions between the official php docker hub and alpine repositories should match if you want to go down the official repository route.

My next venture is going to be building from source. Here you have the freedom to download from the php archives. However, it is important to me that the build args are as much the same as possible. Packages included like gettext, intl, zip and whatever is necessary.

Yet, this is exactly what makes the official images so nice. The solid standard php executable build from source. That's why It would be nice to have this in the official php docker hub.

We run a setup where we have a private repository where we store all our production images. The nice thing now is that everything is version pinned. This way we have exact control over images.

Hello friends, I'm also going through the same situation and I noticed that the discourse is active, I'm setting up a dockerfile for php7.2-fpm-zts, if anyone already has it, it would save me a lot of time.

@italodeveloper I'm not at liberty to openly share the whole image. What I can do though is help you get started with my experience on this so far.

I've based my ZTS image on top of the FPM image. FPM by default ships with the normal NTS version. Then, using the PHP_URL and PHP_ASC_URL which is already set, I download the source from the archives. I use php-config --configure-options to get the original build options as by the FPM image. I sed the following options out: --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data replace the config path to a seperate one I want to be able to configure ZTS completly seperate and add --enable-maintainer-zts, move the NTS binary out of the way RUN mv /usr/local/bin/php /usr/local/bin/php-nts. Start building, after building install move the ZTS version elsewhere and NTS installing back in place. When I've rafactored the whole code a tad -- because it is a real mess now I will post back a snippet here.

I think there is another use case: The PHP 7.2 Parallel API. To me it seems it's made for web requests, but it does require ZTS to be enabled.

@rvdlee-salesupply

I know my version is quite a bit old, but you can test your theories against my php-fpm-zts container if you'd like. I can't find my original Dockerfile at the moment, but I will look for it more tomorrow and see if I can provide that for you too.

https://hub.docker.com/r/smoshysmosh/php-fpm-zts

This php build not supported architecture ARM, i'm use this build from my Docker file and docker printed errors on standart_linux_go:221.
My arch: arm64v8/aarch64-linux-gnu

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhoeric picture dhoeric  路  4Comments

ktrzos picture ktrzos  路  3Comments

solocommand picture solocommand  路  3Comments

sanjay-rakholiya picture sanjay-rakholiya  路  3Comments

ihorsamusenko picture ihorsamusenko  路  4Comments