I haven't read anyone else's replies to this, but I had a dog like this once. He was TERRIBLY afraid of everyone and would just shut down when I took him out in public, shake, get red-eyed, try to dart away from anyone who'd approach him, sometimes even poop himself. I got him at 7 months old, so I'm not sure what was in his past that may have caused him to be this way.
But the thing that helped him the most, was group obedience classes. Since he had to focus on what I was trying to teach him, he didn't have as much mental energy focused on the people around him. So he learned that being in a public setting around other people wasn't so terrifying after all. It was a 6-week class, meeting once a week. After it was over, I asked the trainer if she could let me put him thru the class a second time at no charge just to continue helping his socialization. It worked. He's still a little fearful in crowded situations, especially if strollers or loud children are involved, but he's no where NEAR as bad as he used to be. He will let people pet him now, and sometimes will even go up to certain people to ask for petting. He's come miles from where he was.
Hope this helps...