You cannot derive the mass of the photons applying Planck's and Einstein's equation since it is applicable only to finite particles like protons, electrons, etc.
From Einstein's special relativity the rest mast of a photon must be zero.
Planck's equation give us the moving mass (not the rest mass) of the photon, in fact the total energy of the photon is:
E² = (p•c)² + (m•c²)²
p is the momentum, m the rest mass and c the velocity of the ligth.
Since m = 0 then the equation reduces to:
E = (p•c)
the momentum "p" depends linearly from the frequency, thus:
p = constant*ω
using a single constant "h" and the frequency "nu " we will have:
E = h•nu
But we derived it considering the rest mass to be zero.