When Composer won't recognise your PHP version.
Many internet hosts allow you to choose your PHP version. This might seem a daft idea but it's very useful because different versions of self-hosted platforms run on different versions of PHP.
But what happens when you set your PHP to one version but Composer sees a different one?
All this happens through the command line so that's half of the world getting panicked. It's one reason why so many small business users are becoming frustrated with new versions of applications that insist on using Composer. SSH is horrible (unless you use e.g. Termius and know that the first command to enter is "mc" for midnight commander.
The elderly will be utterly delighted when they've done that because they get something very like the old Norton Commander interface from when we all had to do stuff from the command prompt :)
This situation arises because, obviously, the server has to have a common base PHP version.
Composer (it's a command line suite of tools that manages stuff in the bowels of your platform that has a nice friendly user interface) has a requirement for PHP of a certain version or above.
But Composer doesn't "see" what you selected - it "sees" the base version and issues an error message that your PHP version isn't suitable.
Some recent versions of platforms prefer more recent versions of Composer and those require a recent version of PHP.
No one is doing anything wrong: the server company is making sure that as many customers as possible have a version of PHP that installs the applications they install; the platform designers are working to standards likely to have the longest life and Composer, well, it's all a bit arcane and there's no point in trying to argue with it: you just have to do as it says or it refuses to do what you want.
Even when the reason it won't do as it's told is that it looks at the base version, which is always going to be older, not the selected version.
Thanks to the very helpful people at Siteground (www.siteground.com) who explained all this to our confused operator. Thanks to them, we can tell you a solution.
You need to do the following on each website where Composer says it needs a later version that that it finds:
echo "alias composer=\"/usr/local/php82/bin/php-cli /usr/local/bin/composer.phar \"" >> ${HOME}/.bashrc
Note carefully, the PHP version. This is the version that you have set as your choice. It probably won't be 8.2 and note that there's no "dot" in the version number.
After you've run that, run this:
source ${HOME}/.bashrc
You should only have to do it once if you do it in the directory where Composer sits.