8 ms·
I can see a PHP centric shop not feeling all the upside of containers. The typical PHP model is pretty simplistic, so it's not hard to replicate most of the do
by tyingq 5y ago
I can see a PHP centric shop not feeling all the upside of containers. The typical PHP model is pretty simplistic, so it's not hard to replicate most of the docker benefits without using containers at all.
That is, I can manage and deploy php apps with different php versions, database versions, repo versions, etc, without too much pain already. Because deploying a PHP app is mostly just dropping files into a directory and restarting a web server.
- marcosdumay 5y ago> different php versions How do you do that one? Last time I tried (granted, a long time ago), apache-mod-php was hardcoded into a single php version, and you couldn't have different versions of it on apache either. I always classified php as one of the most problematic languages that need containment. There's not only that hard dependency on the version, but the language also has a global configuration storage that, last time I used it, can not be overloaded.
- tyingq 5y ago2 different running PHP-FPM instances. Then, any web server virtual host can choose which one to use. Via SetHandler for Apache.
- beberlei 5y agoYou use PHP FPM (Fast CGI) behind Nginx, so you run multiple PHP-FPMs each with their own PHP version. This falls out of stock Debian/Ubuntu already and can be easily extended to even most recent and older PHP versions through PHP Debian Maintainer Ondrejs PPA. Currently PHP 7.0 - 7.4 and 8.0 available via apt-get
- knownjorbist 5y agoThere's a number of ways to deal with it now. Having different versions of php installed is the easy part, having the webserver send requests to these is a little more tricky. Using PHP-FPM makes this considerably easier as you can have different versions listening on different unix sockets, for example.
- nicoburns 5y agoI don't think many people who are using containers are using apache.
- toast0 5y agoI seem to recall being able to do this with some effort in the old days. You might have to compile the mod_php's yourself though, looks like at least FreeBSD packages have different php versions conflict with each other. If you use php_fpm as others suggest, it would likely be easier. Either way, you need to have some way to indicate which version you want; it used to be common on shared hosting to have .php3 vs .php4 vs .php5 files to indicate which version you wanted; but I think modern PHP tends to have less code that doesn't work with newer versions.
- lkrubner 5y agoAnd yet, when I criticized Docker in 2018, in an article much discussed here on Hacker News, many of the comments pointed out how much something like PHP would benefit. raziel2p wrote: "However, I think the author trivializes the amount of work required to make different types of Python/PHP/NodeJS/whatever apps all work in a consistent way through configuration management, saying "I can just write a bash script or makefile." or "just download roles from Ansible Galaxy". This is so painfully ignorant and irresponsible that I fail to take the article seriously as a whole." From here: https://news.ycombinator.com/item?id=17062288 https://news.ycombinator.com/item?id=17062288
- tyingq 5y agoI can see both sides. If your PHP app depends on non-core modules, or resources that might clash with more than one instance running (apcu comes to mind, or redis), or a complex database layer, etc...maybe docker would help.
- aduitsis 5y agoQuite correct, both sides are clearly visible and there might be some point to using containers anyway. But there's a bigger issue here. The comments the OP received, are heavily worded to the point that they explicitly state that the article made them angry. Regardless of whether containers are suitable or not for task X or Y, it is very difficult to have a normal conversation, if one's comments can actually make people angry.
- afarrell 5y agoIf a person says that thing X is easy for them in their context, default to believing them. If a person says that thing X is hard for them in their context, default to believing them. There is no contradiction there.
- hitekker 5y agoThis reads as: "believe whatever people say because we're afraid to contradict them."
- conradfr 5y agoAlthough if you have multiple projects using the same framework and libraries on the same server, using containers allows you to use opcache preloading.
- skeeter2020 5y ago>> Because deploying a PHP app is mostly just dropping files into a directory and restarting a web server. Lots of solutions can't "just restart a web server" as part of their deployment.
- tyingq 5y agoYes, I didn't claim it as an absolute. Lots of solutions can restart a web server or a PHP-fpm instance without trouble. Or use things other than containers to manage zero downtime.
- Groxx 5y agoLots of solutions don't want to - that's fairly different than "can't". I dare say few companies need nigh-100% uptime, and it costs an incredible amount both in setup and in maintenance to go from "10s outage while updating" to "no downtime while updating".
- conradfr 5y agoAlternatively you can change the symlink to your www directory to the new one.
- miltondts 5y agoWhat exactly do you mean? How do these solutions deal with servers unexpectedly going down? I worked on telecom where you need the service to be up 24/7 and we restarted all the services on deployment. In waves of course.
- maxk42 5y agoWhat do you think the net effect of deploying a new container image is? At some point the server goes down and a new copy is loaded. You could always disable opcaching and then you wouldn't even have to restart the server to deploy a new PHP instance.
- danudey 5y agoDepends on how you set it up, but with a lot of container orchestration these days, you create a new image then point your load balancer at that instead, giving you a clean blue/green deploy without downtime.