I just had the same problem and read all the forum advise:
I fixed mine with the following solution:
iphone 5 does not want to charge or it only sometimes charges and variations of it:
My phone had all the symtoms of most of the problems and solutions mentioned but the solution was the simplest one. My son use to carry the phone in his pocket. The fluff build up in the phone, but you cannot see it as it form a flat hard surface in the back to the charger hole. I did clean it a few times but it still did not work so I though it was a software problem or the fact that I did not use an original apple cable.
Solution: I used a thin wire (the ones used to tie plastic bags). It is soft enough not to damage anything. I kept the one side straight to scratch the charger hole, expecially the corners. I bend the other side into a small hook (2-3mm) to hook out the fluff. Keep on going as when I thought I had all of it out a big lump as hard as stone came out. This seemed to have been the problem as the charger could not get deep enough.
The strange thing was that with the problem I could get the original apple cable to work sometimes but the generics would never work. Now that the muck is out all cables work.
I am still struggeling to clean the speaker holes as I believe they are also full of fluff as the sound is softer than my other phones in my house hold.