In relativity, gravity curves spacetime, and particles (massless and non-massless) follow the shortest paths in that curved spacetime. Therefore, gravity effects photons.
Yes, as nicksauce points out, gravity does not pull things; gravity is simply a curve in spacetime. Photons follow this curve, just like massive particles do.