Photons are gauge bosons that carry electromagnetic charges. No atom can exist without photons. Photons carry the charge from the lepton to the nucleon, holding atoms together. Also, photons are not utterly massless: Feynman and Dirac determined that photons have about 10^-7 ev mass, and change polarity at C. They lose mass by direct energy conversion, and can down-shift to a lighter space-time.
"Generating" photons is something of a misnomer: we "liberate" them by shifting the outer shells of elements with more than 2 electron shells. We do that by heating, applying static fields, etc.
Note that photons and electrons have one thing in common: they are "dual" particles. Note that photons hold exotic elements together (positronium or electronium) for two examples of the lower-mass periodic table.
http://en.wikipedia.org/wiki/Positronium