How do we know that photons are exactly massless and travel exactly with speed $c$ in vacuum? I know that this question may sound stupid, but what I mean is that photons have some energy and no mass, yet the mass and energy are said to be equivalent (or maybe I got that part wrong). In an earlier question I got an answer that gravity is dependent on stress-energy tensor and not simply mass, so that a photon should also create a very small gravity influence. Then how do we know that photons are moving at $c$ and not let's say 99.999999% of $c$?
I'm asking this because of time dilation, because then a photon moving at slightly below $c$ would only experience a massive time slowdown, but still not a complete halt, right?
EDIT:
Note that in the hypothetical case of light being a bit slower than $c$ it would still be a limit of speed used for relativistic calculations but no longer speed of light, so the question isn't exactly "why the light moves with the speed of light?".
 A: There is no way to be 100% sure, but we can put upper limits on the mass.
Massless particles don't have a rest frame, so it doesn't make sense to talk about time dilation in the photon's frame. A massive photon would have a rest frame, so you could eventually catch up to it and move alongside it.
List of experimental limits on photon mass
more comprehensive list
A: Consider a very distant supernova; for example, suppose that the photons of the explosion have to travel a billion lightyears to reach us. If these photons had different velocities, then these differences would cause an accumulating difference in their travel time.
Even if their velocities would differ by as little as a billionth, then the fastest, most energetic photons would reach us one year before the slowest, least energetic ones. Clearly this doesn't happen: when we observe a supernova, we detect all the photons at the same time, regardless of their energy.
A: In special relativity the energy is related to mass and momentum by $E^2 = (pc)^2 + (mc^2)^2$, where $p$ is the momentum. $m$ here is the rest mass of the particle, so for the photons case there is only energy from the momentum. The $E = mc^2$ you are likely familiar with ignores the momentum term, and hence only involves the rest mass.
Photons are the quantised energy of the electromagnetic field. We know from the Maxwell equations, which describe the classical electromagnetic wave theory, that the speed of propagation of the wave is:
 $$c = \frac{1}{\sqrt{\mu_0\epsilon_0}}$$
The numerical value of this is the speed of light we are familiar with. If our quantum theory of light is to be consistent with the classical theory, the speed of the photons must be equal to this value.
But in the end, the speed of light $c$ is defined to be the speed of light in a vacuum, so asking if photons are slower than $c$ is like asking what if sound travel slower than the speed of sound in air. It goes against the definition of the speed.
A: 
Then how do we know that photons are moving at $c$ [...]  the question isn't exactly "why the light moves with the speed of light?".

So the question seems to be more precisely:
"How do we know that the  signal front of any signal that's been exchanged between (suitable collections of) electro-magnetic charges is attributed to the exchange of quanta of the electro-magnetic field between these (collections of) charges?" 
Well, that's still true by definition:
Since evidently signals may be exchanged between (suitable collections of) electro-magnetic charges, we call the corresponding signal fronts "photons".
Having settled this particular question a priori of course there remain plenty other questions which could be addressed experimentally; such as:


*

*Which value (or distribution of values) of "refractive index $n$" characterizes the region containing the charges? (This relates to the electro-magnetic field in the region as far as it constitutes the "signal tail", or as far as it is considered a "standing wave".), or

*Was anything else exchanged between the charges under consideration, as part of the "signal tail"? (Such as neutrinos, or Z bosons, or the hypothetical Proca particles etc.)
A: Light always has no rest mass. The tiny negligible amount of gravity would not slow light down. Instead it may add or take energy from the photon/s. We know light moves at the speed of light because that is the speed of causality. If light somehow went faster than light time-travel would be possible and we know that is impossible. Light has momentum but not mass. Some people consider relativistic mass and consider light to have it but that is not the same thing as rest mass. 
A: If photon got no mass, you got first particle which got no dual nature. I don't know who teaching this photon got no mass. If you say it got no rest mass when travelling at speed of light than fine. Remember, if you reduced speed of light even in vacuum if you can, it will got rest mass tiny winy how much you reduced speed. How you can, nobody got idea. But light speed reduced in other medium so photon got non zero rest mass there. But, photon got mass everywhere and wave nature as well but no rest mass as a assumption of only one equation, thinking it is so small, lest reset zero to this number, if you reset zero to -1, It got mass again. But that equation become complicated and hard, the famous one emc2, which is not fully correct as it is only for particle which got speed less than light. For light, it can't measure mass, so useless. What is point of equation, if it can't give value of two variables at same time out of three in it.
