Besides the major nutrients, phosphorus (P) is an essential mineral for both the host animal and the porcine gut microbiota. Different strategies including phytase supplementation and more recently lactic acid (LA) are used to enhance the P availability from cereals in pig diets; however, their impact on the gut microbiota has been rarely related to fecal shedding of opportunistic pathogens. The present study investigated the effect of phytase supplementation and the treatment of dietary cereals with 2.5% LA on the fecal microbiome composition of metabolic active bacteria and expression of virulence factor genes of enterotoxigenic Escherichia coli and Clostridium perfringens in growing pigs. Phytase supplementation reduced the fecal abundance of the most abundant Lactobacillaceae family, whereas the LA-treatment of cereals had a stronger impact on the bacterial community, reducing amylolytic, pullulanolytic and hemicellulolytic Lactobacillaceae , Lachnospiraceae and Ruminococcaceae as well as the fecal bacterial species richness (Chao1) and diversity (Shannon index). Mainly the family Clostridiaceae benefited from the decline in the aforementioned families, being enriched by both dietary treatments. Multigroup data integration using sparse partial least squares-discriminant analysis showed that among the most discriminative operational taxonomic units (OTU) especially two unclassified Clostridiaceae -OTUs, one Prevotella copri -like OTU and one OTU within the vadinCA11 group were associated with calcium and P levels but were negatively linked with complex carbohydrates in feces. Heat-stable toxin A ( Sta ) of enterotoxigenic E. coli and Stx2e of Shiga-toxin producing E. coli were expressed in feces but were similar among feeding groups. Without modifying the total bacterial gene copies and virulence factor expression of E. coli , both dietary phytase supplementation and LA-treatment of cereals drastically altered the bacterial community composition in pig feces. Results thereby allowed for the characterization of bacterial nutrient dependencies, indicating a link between fecal P availability, complex carbohydrate composition and alterations in the predominant genera.