As we know that the Law of Newton's Gravitation, gravitational force depends on the masses of interacting particles but not on their energies. And we also know photons are massless, chargeless, energy pockets.
So, there are only two possibilities. The 1st possibility is "Photons do possess trivial masses and the theory about them saying they are massless would be invalid" or the 2nd possibility is "energy can also be influenced by gravity and the law should be reformulated".