I had this problem today. Visual inspection with a flashlight but no magnification didn't show much except that the socket hole was not as deep as it should be. I took the flexible plastic toothpick out of a Swiss army knife and gently scraped the bottom of the socket with the tip. Then I tapped the phone on a piece of white paper and saw some debris (dirt) come out of the hole. I continued this and after I made a good start, a lot of debris came out. Finally, I pulled out a large piece of pocket lint.
I suspect that if a little dirt gets in the hole, pushing the plug into the socket compacts the dirt into a flat layer, and if enough dirt gets in there, the plug will no longer connect.
The solution is to clean the socket out gently with a flexible plastic tool, such as the toothpick in a Swiss army knife, so that you do not damage the pins. To prevent the problem the phone should be kept in a clean pocket, or in my case, where my pockets just aren't clean, I will keep the socket covered with a bit of gaffer's tape when not in use.