Very Siberian's picture

Hello! WordPress seems to be continuing its march toward higher versions of PHP. I now have one plugin that I cannot update since it requires PHP 7.4. I do not want to risk breaking my otherwise functional installation, so if there is an officially sanctioned way to update the PHP version safely, I would appreciate learning about it!

Best regards,

Rob

Forum: 
Jeremy Davis's picture

Behind the scenes, we're madly squirrelling away getting the v17.0 release ready (if you weren't already aware, we have Core and TKLDev RCs available).

So one option (perhaps not a great one by the sounds) is to just wait. Unless you need the newer plugin version or it's a security update, then you could just wait... I don't know how long it will be exactly, and I hate to speculate too much (and risk raising expectations and/or causing dissapointment) but I would hope we'll be releasing updated appliances within the next few weeks.

Another option would be to do a Debian "in place" upgrade. That will move you to the newer Debian 11/Bullseye base. That includes PHP 7.4. Please note though that until we officially release v17.0, our apt repositories can not be considered completely stable. So there is a risk that something may get broken between now and our official release of v17.0. So you may need to make some manual adjustments. I'll post about that if that's required.

A third (and perhaps the best?) option is to install newer PHP from Ondřej Surý's PHP repo. If you're not already aware, he is a Debian & Ubuntu developer who also contributes to the official Debian/Ubuntu PHP packages. So his personal repo is definitely a reputable source. I do hope to implement a super easy way to change PHP version at some point (leveraging this third party repo) but I can't continue work on that until we get v17.0 stable released.

There is a really barebones readme, but there is also an old post here on the forums that provides much more detail. It is for installing PHP7.3 on TurnKey v15.x, but should still be relevant. I would personally like to tweak those instructions a bit as they don't quite comply with "best practice" (e.g. it puts the key in /etc/apt/trusted.gpg.d/php.gpg rather than pinning it - it also doesn't note about how to pin PHP packages, etc). but it should work ok and I can provide additional details when I get a chance.

If you do go with the second (Debian upgrade) or third (sury.org updated PHP) options, then it would be super awesome if you could document the process! You could post it to a new page in the website docs (they're a wiki that anyone logged in can edit). Creating a new page using that link will make it appear in the Tutorials / HOWTOs page.

Very Siberian's picture

Thank you, Jeremy! I was able to update to PHP 7.4 by following these instructions:

https://github.com/alfreddagenais/turnkeylinux-wordpress-helper/wiki/Upgrade-PHP-Wordpress-Turnkey-Linux-From-7.3-to-7.4-Debian

However, I seem to have fragmented my repo sources. I say this because I had installed memcached when still on PHP 7.3, and now seem to be unable to update it to the PHP 7.4 version from the Ondřej Surý repo. I would be happy to convert the above to a Wiki page, but I would not want to get others stuck as I now am. 

Do you happen to know of any easy way to install memcached from the Ondřej Surý repo? If so (and I get my appliance unfragmented), I will be happy to post an update.

Best regards,

Rob

Jeremy Davis's picture

I just had a quick look at the instructions you followed and they also the Ubuntu PPA! (see "step 6"). I have no idea why they do that?!

There is no reason to do that! The PPA is for Ubuntu, packages.sury.org is for Debian. They contain the same packages, just built for Ubuntu and Debian respectively. Whilst Ubuntu is (mostly) built from Debian source, it is not binary compatible with Debian, so it's bad practice to add Ubuntu PPAs. Doing so is considered a FrankenDebian.

It's almost certainly not the cause of your immediate issue, and is likely not an issue in this instance at all, but it's bad practice and is guaranteed to bite you one day...

With that rant out of the way...


I'm not sure why memcached is no longer working for you?! So long as you removed the default Debian package and installed the newer, relevant versioned package it should work. From what I can see, the Debian package doesn't include the PHP version in the package name, but the sury.org version does. Assuming PHP7.4 (adjust as necessary) try this and fingers crossed it will work:

apt remove php-memcached -y
apt install php7.4-memcached -y

IIRC you'll need to restart Apache. Plus you may ned to migrate your config too.


Also, please be aware that you will no longer get automated updates for PHP. You'll need to manually update the PHP packages from time to time. I'm not sure if such a thing exists, but if there is a PHP security alters mailing list, it might be a good idea to sign up to it?! (please post back if you find one - I had a quick search and came up blank...)

Very Siberian's picture

Thanks again, Jeremy! That worked perfectly. I am just trying to stay afloat until TKL 17 comes out.

I really appreciate your help!

Rob

IanH's picture

Followed the link provided by "Vey Siberian" to update to PHP7.4 to get rid of the Wordpress warning.

The instructions now mention Jeremy's warning about adding PPA and make it clear it is not needed.

The process updates to PHP8.1 but the later instructions also add PHP7.4.

php -v from the shell shows version is 8.13

Wordpress just sees PHP 7.4 and the warning goes away.

 

For Jeremy's information I tried to use TKLDev17rc1 to create Wordpress VM. I will document the outcome under the 17.0 blog

 

 

Very Siberian's picture

@IanH, thank you for sharing the update!

 

P.S. My screen name, Very Siberian, implies a love of Siberian huskies and does not endorse the Russian invasion of Ukraine in any way.

Add new comment