I would suggest to check first :
- if there any dust inside the port (it sounds stupid but it surprisingly a very commun issue after many years of use)
- if the cable is the problem, so use an other one
- if there is any visible damages inside the lightning port