The most common reason an iPhone stops ringing when you receive a call or text message is because your ring / silent button is turned on. Accidentally activating the mute switch is especially easy on newer models, such as the iPhone 6 or 6s. The ring / silent button is located on the left hand side of your device above the volume buttons. You will know if it the button is on mute if it is in the down position and you can see a small red line.
If your silent button is not on mute then check your Ringer volume by going to your Home screen and pressing the top volume button.
If your volume is adjusted and your silent switch is off, but your iPhone will still not ring, swipe up on your Home screen to open Control Center. From here you can check if the Do Not Disturb feature is enabled on your device. If the half moon icon is white then your phone is in Do Not Disturb mode. Just tap the moon icon to disable it.
If none of these troubleshooting tips have helped then you may have a hardware problem and you will need to visit your local Apple retail location.