Water, along with probiotics, and fruit are all helpful when dealing with constipation. (Prunes, grapes)
After dealing with several GI (pediatric specialist GI at that)... The latest one I think was actually helpful, and finding a good GI is very valuable. If GI suggests just constant miralax, find a new one. Our latest one had us do a full clean out, which is not a great experience, but it was very needed and the behavioral changes noted afterward made it very worth it! And then after clean-out keeping up with exlax regiment and most importantly consistent dedicated toileting schedule (twice a day extended time sitting), even if you have to use glycerin suppository (Make sure to get Doctor's ok and advice on this, as it can also do harm if not done correctly) to ensure success at least (better if twice) a day. And absolutely add fiber and water to diet. However if dealing with other intestinal disorders raw veggies may do more harm than good. After clean out stick to easy to digest foods and lots of water for several days, then slowly add in other foods and watch to see what happens. Stomach issues take a lot of detective work to figure out, a good GI, Allergist and regular pediatrician can be priceless support.
Yes fiber is important but definitely make sure the plenty of water goes with that or else the fiber has the potential to bulk stool too much & make it harder to go! My daughter has tons of trouble drinking the water she needs, that can be a challenge. A good product is called CleanseMore by Renew Life but he has to be able to swallow capsules. It makes stool easier to pass & bowels do not become dependent on any of ingredients. Important to only start with 1 pill. He is 10 & that was around the age my daughter tried this product. Very helpful but only use one capsule (serving size says 2).
He probably needs more fiber in his diet. The bowel movements might be coming out hard and he wants to avoid that. I started my kids when they were very young on baby prunes from Gerber or Beechnut. I tried the small package and moved up.If that doesn't work, you can try broccoli w/ his meals. The Pediatrician recommended prune juice but my kids didn't like it. Make sure too that he's drinking a good amount of drinks especially water as it helps the movements .If you're still having a problem you can always take him to a Pediatric GI.