|OS type and version:
|Related products version:
||php 7.2, 7.3, 7.4, 8.0
Due to the recent sunsetting of Ubuntu 16.04, I recently completed an upgrade of 5 16.04 servers to 20.4. As part of that upgrade I also implemented a multi-php option in Virtualmin, with the ability to run cli, cgi and fpm modes. This was a literal upgrade of 16.06->18.04->20.04 using do-release-upgrade. Everything went well.
I am now wanting to create a fresh, clean AWS image of Ubuntu 20.04 configured just the way I want it, with all my tools and nothing more, so that in a time of need it’s ready to go. I did this, using an option within AWS, and then more or less followed the steps I used for the upgrades. This all worked until I got to the part for the multi-php configuration. I added
deb Index of /ondrej/php/ubuntu focal main
to sources.list.d as normal. But apt can’t see everything. When I use Package Search and search for php7, all I see is a few modules for php 7.4.
What am I doing wrong? Is there a specific ubuntu dist that I would use or avoid? Is there something else that needs to be included first?
Ubuntu 20.04 is the only Ubuntu version it makes sense to install today.
ondrej repo has several versions of PHP. If you followed the instructions for the PPA, I’m not sure why you’re not seeing them. But, I don’t use this PPA, so I don’t know.
Finally, I don’t recommend you install a bunch of PHP versions. You should only do so if you must have multiple versions for compatibility with some particularly cantankerous application that can’t work with the version that is provided by your distro. I’ve noticed that the more PHP versions someone has, the less likely they are to be able to keep everything working and secure (this applies to everything…the more things you have to stay on top of, in terms of updates, configuration changes, etc., the more likely you are to miss something, make a mistake, or end up running and depending on something that is no longer maintained…with PHP, or any web application language, this is a particularly dangerous situation to be in).
Here’s the best way to install several versions of php. I also use U20.04, and I just did the same thing. Multiple PHP Versions – Virtualmin
Oh, also one of the most common problems people run into when they install other PHP versions is that also install mod_php and it breaks things. This is always a mistake, and you should not do it. There is never a reason to install mod_php today.
You would think, right? I have to support a 3rd party app though that relies on passing config variables in ENV settings (IIRC) and apparently that only works with mod_php. I’m fuzzy on the details, but that’s my recollection of why mod_php was required for that site. It’s working though…
clear_env no; in your php-fpm config file for that domain.
You can also set variables in the php-fpm config file, which is generally safer than passing the whole env over.
Thank you all, it seems to be working now. I used the Virtualmin docs version. The result, as shown in the Repositories panel of Software Packages, looks identical to what I had previously put in via that page. So I guess add-apt-repository does something more? In any case, it seems to be working.
Thanks Joe, I will try that. I would just as soon disable mod_php.
This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.