It’s not possibel to change the PHP version on free hosting.
Premium hosting do have multiple PHP versions, but if the software needs outdated PHP version then it’s generally recommended to find more up to date softwares instead.
As of the database issue, have you checked this out yet?
I just had a look at the system requirements of Forma LMS. Their only available public version right now (4.0.19) only supports PHP 8.1 and MySQL 5.7. In other words: their software only works on server software that is end of life and doesn’t get security fixes anymore.
Their paid version is slightly better, but they still don’t support PHP 8.3-8.5 and MySQL 8.x.
They don’t seem to be doing so well with staying up to date with software versions. And the fact that this is a problem for them at all suggests to me that their code quality isn’t great.
So I would recommend to avoid their software if you can.