My iPhone would intermittently start and stop charging and so I went to the Apple Store to have my iPhone fixed or replaced under AppleCare. The Apple specialist took a paperclip and dug it into the power port of the iPhone. She proceeded to dig lint out of the power port and now the phone works as good as new!
Recently, I’ve been having problems with my headphone jack as well, so I used the same trick and dug out a pile of lint — now all is well!