If you are on a Standard or Premium plan of App services, you can add a deployment slot in your web app setup, which will help to test any changes before being deployed in production environment. So, as a first step, you need to upgrade the plan, if you are in basic plan
After upgrading the plan, you can add a deployment slot from here:
While, creating the slot, make sure that you are cloning the existing website
After the deployment slot has been created, you will have the exact copy of the website within the same LAMP version as the production has.
Now, you can try your version changes in the deployment slot and test it. For that, open the deployment slot created and change the versions as needed
Hope this helps in addressing your concerns.
--please don't forget to upvote
and Accept as answer
if the reply is helpful--