Why doesn't De Broglie's wave equation work for photons?

What you have there isn't actually de Broglie's equation for wavelength. The equation you should be using is

$$\lambda = \frac{h}{p}$$

And although photons have zero mass, they do have nonzero momentum $p = E/c$. So the wavelength relation works for photons too, you just have to use their momentum. As a side effect you can derive that $\lambda = hc/E$ for photons.

The equation you included in your question is something different: it gives the Compton wavelength of a particle, which is the wavelength of a photon that has the same electromagnetic energy as the particle's mass energy. In other words, a particle of mass $m$ has mass energy $mc^2$, and according to the formulas in my first paragraph, a photon of energy $mc^2$ will have a wavelength $\lambda = hc/mc^2 = h/mc$. The Compton wavelength is not the actual wavelength of the particle; it just shows up in the math of scattering calculations.