Hosted Servers are very “quirky” compared to Dedicated Servers. But I’ll save that rant for another day
So, on a Hosted Server each “environment” can be individually configured (up to a point). What you can do is have a “master” PHP version installed on the Server, whilst running other versions in their own environments for each customer.
Therefore, when you run
php -v
on the Server the output doesn’t always represent the version of your particular environment. I guess your PHP version is configured by either the Web Host or via your cPanel settings, so you’ll have to refer to their documentation.
To check the specifics of your actual environment, the best trick is to create a phpinfo.php file (as mention here). Just pop it in your working directory and load it in a browser. The results will be specific to that installation directory.
I hope this makes some sense?
Anyway, when you work out how to configure your specific environment then that should solve your problem.