How to upgrade PHP depends on the operating system viz. control panel you have been given. As such it is outside Moodle. Some even support running two PHP versions in parallel.
Personally I won't upgrade or touch my production server any other way just because of a test Moodle. If you plan to upgrade your production Moodle from 3.7 to a supported release, it is a different matter. But then I would go through the process in a different (staging) server.
Personally I won't upgrade or touch my production server any other way just because of a test Moodle. If you plan to upgrade your production Moodle from 3.7 to a supported release, it is a different matter. But then I would go through the process in a different (staging) server.