We investigate the elastoviscoplastic flow through porous media by numerical simulations. We solve the Navier-Stokes equations combined with the elastoviscoplastic model proposed by Saramito for the stress tensor evolution. In this model, the material behaves as a viscoelastic solid when unyielded, and as a viscoelastic Oldroyd-B fluid for stresses higher than the yield stress. The porous media is made of a symmetric array of cylinders, and we solve the flow in one periodic cell. We find that the solution is time-dependent even at low Reynolds numbers as we observe oscillations in time of the unyielded region especially at high Bingham numbers. The volume of the unyielded region slightly decreases with the Reynolds number and strongly increases with the Bingham number; up to 70% of the total volume is unyielded for the highest Bingham numbers considered here. The flow is mainly shear dominated in the yielded region, while shear and elongational flow are equally distributed in the unyielded region. We compute the relation between the pressure drop and the flow rate in the porous medium and present an empirical closure as function of the Bingham and Reynolds numbers. The apparent permeability, normalized with the case of Newtonian fluids, is shown to be greater than 1 at low Bingham numbers, corresponding to lower pressure drops due to the flow elasticity, and smaller than 1 for high Bingham numbers, indicating larger dissipation in the flow owing to the presence of the yielded regions. Finally we investigate the effect of the Weissenberg number on the distribution of the unyielded regions and on the pressure gradient.