Because photons travel at the speed of light, we need to consider relativistic effects. Under special relativity, classical momentum (mass * velocity) is not actually conserved. To achieve conservation of mass, we consider the "inertial mass" of an object instead of the classical mass, where the intertial mass is given by:
m'=ym
y=1/sqrt(1-(v/c)^2)
As you can see, y>1 and y approaches infinity as you speed approaches the speed of light. This is why we say that the mass of an object increases with its velocity, and that any object with mass traveling at the speed of light will have infinite mass.
Now consider the momentum, p, of a photon. We have:
p=m*y*v
m=0
y=infinity
v=c
this gives us p=0*infinity, which is indeterminate, so we cannot use this equation to determine the momentum of a photon.
Instead, we can use the engery-momentum relationship, which states:
E^2 = (mc^2)^2 + (pc)^2
(This is a generalization of the famous E=mc^2 equation to also consider the momentum). In this equation m refers to the rest mass, not inertial mass. Because we are dealing with a photon, we have m=0, which gives us:
E^2=(pc)^2
p=E/c
Indicating that the momentum of a massless object is proportional to its energy.