When my son was 3.5 and still wasn't pooping in the potty "b/c he was scared of the big poop hurting", I put him back on baby/toddler food 3 meals a day, w/fruits and veggies for snacks. He got his nutrition, softened up and started pooping regularly again w/ease after a day or two...in the potty...b/c it didn't hurt anymore! After being on baby food for about a week, I started transitioning him back to real food and within the next week or so, he was back on real food, pooping regularly, and we've never had poop problems again.
The baby food helped him remember that pooping didn't have to hurt, and helped him seeing pooping in the potty didn't have to be scary. And it also made him regular again, getting his little digestive system back on track after being constipated for more than a year or so.