The aim of this study was to assess the effects of soil fumigation with methyl bromide (MeBr; CH(3)Br) and methyl iodide (MeI, iodomethane; CH(3)I) on the microbial community structure and diversity in two soils and determine the effects of microbial diversity on the survival of Escherichia coli O157:H7 from contaminated irrigation water. Polymerase chain reaction (PCR) was used to amplify 16S rRNA from total bacterial community composition and the products were subjected to denaturing gradient gel electrophoresis (DGGE). The Shannon-Weaver index of diversity (H') was used to determine the effects of both fumigants on soil microbial diversity. The effect was more severe in sandy soil than in clay soil at the normal application rate of MeBr and MeI. Our results showed that MeBr and MeI have about the same effects on soil microbial diversity. The two fumigants had greater impact on microbial diversity in sandy soil than in clay soil and this resulted in higher survival of E. coli O157:H7 in sandy soil than in clay soil during the 50 days that the study was conducted. MeBr has been used as soil fumigant for >40 years with no serious detrimental effects on agricultural production and our research also suggests that the use of MeI may also produce no long-term detrimental effects on agricultural production since both fumigants had about the same effects on soil microbial communities. Therefore, soil systems with reduced microbial diversity may offer greater opportunities for the survival of pathogenic bacteria such as E. coli O157:H7.