My iphone portrait camera problem

Greeting, my name is ellis i have a problem which I face this problem a lot of time whenever I open my camera it works and then I switch to portrait mode it gets shut down itself help me.

Clearing the cache and data of the camera app can sometimes resolve issues related to its functioning. Go to your device’s Settings., find the Apps or Applications Manager section, locate the camera app, and clear its cache and data. Note that this may reset any personalized settings you have made in the app.