Walt's picture

I'm needing to upgrade php7.4, which is now deprecated, to php8.1 on LAMP stack, Joomla4 Stack, orangeHRM stack, etc. I'm new to linux, and love turnkey approach. It's slick.

Can I do this from the command line, and if so, how?

Forum: 
Jeremy Davis's picture

The first question to ask yourself is do you actually need a newer version of PHP? Unless the software explicitly requires a newer version of PHP, it is recommended to just continue using PHP7.4.

The reason for that is that whilst 7.4 is EOL (end of life) from upstream (i.e. the PHP devs themselves), it is maintained in Debian (and other Linux distros). You will get backported security patches auto applied from the Debian repos. So the security of PHP itself shouldn't be a consideration in your choice whether to upgrade to newer PHP or not.

Some software "warns" that PHP 7.4 is EOL and/or that you can get better performance, etc if you upgrade PHP. There may be some legitimacy to those performance claims, but in my personal experience, there is no noticeable performance improvement 7.4 vs 8.x (as there was between PHP5.6 & PHP7.x).

Having said that, many recent PHP projects actually have a hard requirement of PHP 8.0+. I.e. some software just won't work with anything lower than PHP8.0. In those cases, updating PHP is the only option. AFAIK, all the appliances that we provide that require newer PHP, come with it (usually PHP8.1) pre-installed. E.g. Nextcloud, Invoice Ninja", Bookstack, and others.

If you want/need to update PHP, then there is a trusted third party repo that we use: https://deb.sury.org/. It contains very basic instructions, plus there are a number of forum threads that cover the process, but this recent one provides some links to other threads on what is required. As noted there, you will find a myriad of other sources, any related to Debian should apply directly to TurnKey.

Sorry that I'm not more explicit about the required steps, but hopefully that's enough to get you going. If you have problems and/or can't get it working as required, please post back and I'll do my best to assist. It's relatively straight forward, but there are a few reasons why it might not "just work".

Jeremy Davis's picture

To clarify, if you come across any TurnKey appliances where the latest release of our appliance doesn't support the latest release of the upstream software, then please let me know. My understanding is that we've updated them all already, but obviously the sands shift...

I.e. you mention Joomla4. If the latest release of that Joomla4 actually requires PHP8.0+ (i.e. fails, gives you a "white screen of death", etc) on the most recent TurnKey release, then I'm more than happy to help you get it working again. But I'd also like to be aware so that I can release an updated appliance that "just works".

Walt's picture

It's my understanding that Joomla4 has newer security features requiring php8+. It does appear to run faster.

Jeremy Davis's picture

Thanks for your feedback.

I can't speak to any new features that requires PHP 8.0+ or performance, but according to the docs whilst PHP 8.0+ is recommended for Joomla4, it's PHP hard requirement is only v7.2.5+.

Considering that when you update to newer PHP, you lose the automated PHP security updates, I'm inclined to leave the current appliance as is (i.e. with PHP 7.4). I'm 99% sure that the reference to security (with newer PHP) is more about the fact that technically PHP7.4 is EOL (end of life) and is not receiving any updates from the PHP team (i.e. not even security updates). However, as I noted in my first post, that's not an issue on Debian.

Having said that, I think having an easy way to upgrade (or even downgrade) PHP version on all of our servers that include PHP would be a good thing! Also a way to auto install updates from the third party repo (not strictly security updates only - but probably unlikely to break things) would also be a nice optional feature.

Also, I'm guessing from your comment about performance ("It does appear to run faster.") that you managed to update PHP successfully? If that's the case, could you please share a bit about the process? I'm particularly interested in the resources that worked best for you and any specific pain points you hit. Thanks in advance.

Add new comment