Babies started solids but

Graphic picture. My 
 Sons started solids but he's been constipated and then had these really solid poos that smell horrible and hurt him. I've found slight blood on some of them but I've read that's because he may have a tear from it coming out. Anything I can do to help him???!!! I don't feel comfortable giving him apple juice and prunes haven't worked.