Package version inconsistency on YII2

'm having hard time getting my existing YII application to run on Ubuntu server.

I installed LAMP stack, cloned the repo and tried to use composer to install dependencies, but there’s a great inconcsistency between versions of PHP required by packages. Some of them require PHP >= 7.4, others <= 5.1

Current PHP version is 8.2 which I upgraded from the default of LAMP stack because on my Windows machine I was able to use composer successfully with this version of PHP installed.

You need to be more specific: how does your composer.json looks like and what errors do you get?