Abstract Metallophthalocyanines (MPc) have excellent photoelectricity properties. However, their low solubility in the sol–gel precursor and their tendency to aggregate make it difficult to get their homogeneous composites with the traditional sol–gel schedule. To overcome this problem, a newly developed “in situ synthesis” technique during the sol–gel process was successfully used to synthesize transitional metallophthalocyanines in the silica xerogel matrix. As a result, a new kind of organic/inorganic nanocomposite was obtained. The characterizations of the glass sample and the extract were carried out by methods of IR, UV/Vis and fluorescence spectra. The microenvironment of MPc is inferred from the change of the pore structure of the matrix, and the reason why MPc exist in the form of a monomer is given. From the view of the different structures of transitional metallophthalocyanines and rare-earth metallophthalocyanines, it is also discussed why rare-earth metallophthalocyanines cannot be synthesized in the matrix while transitional metallophthalocyanines can.