Hey Kaz_GL6,
Thanks for using Apple Support Communities! I understand when your iPhone is connected to charge, you're not able to hear any sound. I definitely want to look into this with you and get you on the path to resolution.
To start, I recommend taking a look at the resource below. This goes over some general troubleshooting steps to take when you're unable to hear sound from your iOS device.
If you hear no sound or distorted sound from your iPhone, iPad, or iPod touch speaker
If those steps don't help, I would like to get a bit more information on what's happening so we can continue working toward a resolution.
Does this happen with multiple chargers?
Are you using an Apple brand charger?
Are you charging with a wall outlet, another device, or in the car?
Thanks again, and have a great day!