Oh Stressyhead I feel for you and your ds. We went through this with our ds and it's so distressing. I've had a skim through my baby book, where I write everything down, to remind me of the things that we did. Here they are (in no particular order).
Baby suppositories help a bit when you can see the baby is trying to pass a painful poo. But don't use them habitually.
If a poo is coming you can help ease your dd by laying her on her back, knees bent, nappy off but still under her, and hold a very warm damp babywipe over her anus. If the anus is stretching painfully, very gently press just beneath it (as you look at her ie towards the spine). You'll feel that the poo is pressing against your finger through her flesh and giving some support just then seems to help.
Prune juice and tomatoes (juice or otherwise) are very good.
I was constaantly tolkd to increase his fibre intact, but my gut feeling was that he maybe had too much fibre and that was making his poos even bigger. So I reduced his fibre slightly by giving him white bread instead of wholemeal and there was a big improvement within a week.
Replacing as many wheat-based products with oat-based also hellped. The fibre in oats is much gnetler on the gut than the fibre in wheat.
Reducing his meat intake made a big difference. Liver particularly constipates him, even now (nearly 3) so give meat with fibre-rich veg, and not more than 3-4 times/week. Fish causes no problems, and I try to give him 1-2 vegetarian days each week with beans/lentils for protein.
These are all things that helped our son at a similar age. I don't know whether they would work for you, but HTH.