Because a photon has a momentum, we can calculate the relativistic mass of it according to the special relativity. Also according to this theory, the relativistic mass is proportional to the rest mass when the speed is determined, which means only when the rest mass isn't zero can the relativistic mass not equals to zero. So we cannot consider the rest mass of photon equals to zero. However, once we consider the photon travels at the speed of light, the proportional factor between the relativistic mass and the static mass, $\gamma$, runs to infinity. So, the rest mass has to be zero when the momentum is determined.
This seems contradictory.