re: How would you Dockerize PHP app? VIEW POST

FULL DISCUSSION
 

Hi @mstrsobserver , I've got a little experience in dockerizing a PHP app. I've put a distributed PHP app in production on openshift (based on k8s) and we choose to split each "microservice" in 2 containers to respect the docker philosophy (one process per container):

  • A web container with Apache and static files
  • A PHP-FPM container

Even if it's working, I have the feeling that it's not optimal as the TCP connection between Apache and PHP-FPM is not kept alive.
Moreover, if you need a session affinity, be aware that it's not possible on k8s if you have a depth greater than 1 in your container architecture.

In the end, I'd suggest to put the web server (Apache or Nginx) and the PHP server in the same container.

As an alternative, you can also get rid of the Web server by using a standalone library like swoole.

code of conduct - report abuse