Phytase is well studied and explored, however, little is known about its effects on the microbial ecology of the gastrointestinal tract. In total, 400 one-day-old female Ross 308 chicks were randomly distributed to four experimental groups. The dietary treatments were arranged as a 2 × 2 complete factorial design, with the factors being adequate (PC) or insufficient calcium (Ca) and digestible phosphor (dP)(NC) and with or without 5000 phytase units (FTU)/kg of Escherichia coli 6-phytase. The gastrointestinal tract pH values, ileal microbial communities and short-chain fatty acid concentrations in the digesta were determined. The reduction in Ca and dP concentration significantly affected pH in the crop and caeca, and addition of phytase to the NC resulted in a pH increase in the ileum. The reduction in Ca and dP concentration significantly lowered, while phytase supplementation increased ileal total bacterial counts. Additionally, the deficient diet reduced butyrate- but increased lactate-producing bacteria. The addition of phytase increased Lactobacillus sp./Enterococcus sp. whereas in case of Clostridium leptum subgroup, Clostridium coccoides - Eubacterium rectale cluster, Bifidobacterium sp. and Streptococcus/Lactococcus counts, a significant Ca and dP level x phytase interaction was found. However, the recorded interactions indicated that the effects of phytase and Ca and dP levels were not consistent. Furthermore, the reduction of Ca and dP level lowered Clostridium perfringens and Enterobacteriaceae counts. The analysis of fermentation products showed that reducing the Ca and dP content in the diet reduced total SCFA, DL-lactate, and acetic acid in the ileum whereas phytase increased concentrations of these acids in the NC group. This suggests that P is a factor which limits fermentation in the ileum. It may be concluded that phytase plays a role in modulating the gut microbiota of chicken, however, this is clearly linked with the levels of P and Ca in a diet.