Note that the quantity ##E/c^2## depends on the frame of reference, because E, which stands for energy, depends on the frame of reference. The invariant definition of mass does not depend on the frame of reference, but the result is always zero.
By virtue of being independent of the frame of reference, the modern definition of mass, which results in zero for the mass of a photon, is an intrinsic property of a photon that's independent of the choice of reference frame. This also ties in well with Newton's original idea of mass as a "quantity of material", which has the property as being a property of the material and not a property of the combination of the material and the frame of reference.
Popularization of the idea that "energy is mass", related by the famous formula ##E=mc^2##, is not compatible with the idea that mass is a "property of matter", because the energy depends on the state of motion - that's rather the whole point!
Let me belabor this point a bit, because I think some readers may be confused about it. (I'm not singling out any specific reader or respondent here, my intent is simply to make some comments based on the numerous times I've seen similar threads in the past).
If a moving baseball has more energy than a stationary baseball (which is true), then energy is not a property of the baseball itself, because one needs to know about both the baseball and what frame of reference it is into know the energy of the baseball. Put this way, I hope this is obvious - but experience tells me nothing is so obvious it can't be argued about. I probably won't feel terribly motivated to argue much more about this if it doesn't seem obvious to the reader, though.
Photons, unlike baseballs, are never at rest. But the energy of a photon shares the property with the energy of a baseball in that it depends on the frame of reference. In the case of a photon, doppler shift chaanges the frequency of the photon when one considers an identical photon from different frames of reference, and by the relation ##E=h \nu##, it also changes the energy of the photon.
Modern professional practice is to talk about the energy and momentum of the photon as frame dependent quantities, often combined into something that's called "the energy-momentum 4-vector", and leaving "mass" as a frame independent quantity that does not depend on the frame of reference. So when one talks about frame-dependent quantites, one talks about energy, and when one talks about frame independent quantities, one talks about mass.
Modern pop-science practice is to talk about energy as if it were interchangable with mass, often resulting in confusion when people do not realize that to know the energy of an object, one needs to know it's frame of reference. And there's no real need to introduce a synonym for energy, mass, when one really means energy. It's clearer just to call energy energy, leaving the term "mass" free to mean something else.
In the full context of general relativity, weighing a photon can give answers that are up to a factor of 2 different from ##E/c^2##. But it gets technical, and even a lay discussion involves some long background setting to define exactly what is being measured and how, down to the nitty-gritty of the experimental details. The technically correct answer for the source of gravity in General relativity is that it is not just energy, but it is the stress-energy tensor that causes gravity. To try and makes things as simple and clear as I can while using languge that is not overly technical, I will say that energy, momentum, pressure, and stress can all be sources of gravity in General relativity. I often see resistance on this point, but all I can say is that is the way that General relativity actually works. People are very wedded to the Newtonian idea that it is mass that causes gravity, and nothing else. But General relativity takes a different view - it says that energy, momentum, pressure, and stress all can cause gravity. At some point one has to step beyond Newtonian ideas to understand General relativity.