Permanent X(2) gratings can be written in doped silica fibers by coherent irradiation with light at ω and 2ω. The X(2) gratings give rise to phase-matched second harmonic generation (SHG), i.e. subsequent irradiation of the prepared fiber with light at ω results in an output at 2ω. The efficiency with which the gratings can be written depends on the nature and concentration of defect states induced by dopants in the, glass. We present results for fibers doped with Ge and rare earth ions and discuss the implications of our results for the various mechanisms that have been proposed to explain photoinduced SHG in fibers.