Daniele Lolli (UncleDan)'s picture

I am to try to create a virtual appliance for this wonderful piece of software:

Unfortunately it supports up to PHP 8.1.

Any hint to downgrade PHP from 8.2 to 8.1? Add Sury repo? Some "smart" system variable? Some appliance with similar needs to copy/be inspired from?


Thanks in advance.

Jeremy Davis's picture

We've got a dedicated 'tkl-upgrade-hp' script for changing PHP version! Unfortunately it wasn't developed until part of the way through the v18.0 release, so assuming that you're using the LAMP appliance (which was one of the first released) then you won't have it. Even if you do have the script, there is a minor bug where the switches for one of command are in wrong order.

Once we finally finish the release, I do plan to re-release the early appliances so that that script and all the other improvements we've made along the way are included in the latest builds.

In the meantime, you can download it yourself:

wget -O /usr/local/bin/tkl-upgrade-php https://raw.githubusercontent.com/turnkeylinux/common/18.x/overlays/php/usr/local/bin/tkl-upgrade-php
chmod +x /usr/local/bin/tkl-upgrade-php

Then run:


And follow the prompts. Let me know if you have any issues with it.

Daniele Lolli (UncleDan)'s picture

Ok, thanks. But where should I run the script? In the makefile (I can not imagine how to see the propts there...) or in the TKLdev before making the iso?

Jeremy Davis's picture

Sorry I misunderstood. It didn't occur to me that you were building an appliance (I'm not sure why after all the updates you did for v18.0!).

So please ignore my note re that script. In appliance build code, you'll need to do a couple of things:


Add this line:


If you want/need any other packages from the repo other than ones that start with 'php' or the Apache module, then they can be auto pinned (security) at build time by adding them as a space separated list to the PHP_EXTRA_PINS env var in the Makefile. E.g.:

PHP_EXTRA_PINS=package1 package2


Replace the line that includes the lamp plan, with lamp81. I.e.:

include $(FAB_PATH)/common/mk/turnkey/lamp81

And all the php module packages you include in the appliance plan need to include the version. E.g.:



There is at least one exception. The only one I can think of that doesn't want the version is php-pear, although there may be others. If you get a package not found at build time for a package that includes 8.1 in the name, try removing the version number.

Good luck and ask if you have more questions and let me know how you go. I'm also have a look at your code if you push it to GitHub.

FYI, as is likely clear, the PHP version can be changed to any PHP versions provided by sury.org - scroll down and look for directories that start with phpX.Y. Although it will also need an associated version plan in common.

Also note that only PHP versions supported by upstream are guaranteed security updates - although I know that if sec updates are available for old, unsupported versions, the maintainer of DEB.SURY.ORG will apply them when possible. It's also important to be aware that non Debian PHP versions aren't auto updated and will required regular manual update.

Daniele Lolli (UncleDan)'s picture

It didn't occur to me that you were building an appliance (I'm not sure why after all the updates you did for v18.0!).

Two main reasons:

  1. life is an experiment :-)
  2. We don't have that appliance and I find it super nice!
Jeremy Davis's picture

Awesome, thanks mate! :)

I hope that my previous post helps. Good luck and as I say, please feel free to ask if you have more questions!

Add new comment