My dd cryed for months when doing #2's, was heartbreaking

so I know how it feels!
In the end our GP thought she may have gotten a fissure from a bout of diarrehea initially and then because it hurt she started trying to hold it in.
we tried all the prunes, pears, tried to get water into her but none of it worked. In the end we used Lactulouse. #2's had to be VERY loose for a long time in order for it to heal.
She was on lactulouse for about 2 months which worked fantastically and eventually we weaned her off that and used kiwi crush which was awesome for keeping her regular and soft. Mind you she was almost 9 months and drinking from a sippy cup when we used that, so might be too early for your little one.
You can get lactulouse from the chemist (but is costs around $15) Your Dr can prescribe it so you get it for free.
Would definitely reccomend going to the Drs. Its heartbreaking to listen to them cry when there is nothing you can do and they don't understand.
Hope he gets better soon.