The generation of γ photons and positrons using an ultrahigh-intensity laser pulse interacting with various plasma solid foils is investigated with a series of quantum electrodynamic particle-in-cell (PIC) simulations. When ultrahigh-intensity lasers interact with plasma foils, a large amount of the laser energy is converted into γ photon energy. The simulation results indicate that for a fixed laser intensity with different foil densities, the conversion efficiency of the laser to γ photons and the number of produced photons are highly related to the foil density. We determine the optimal foil density by PIC simulations for high conversion efficiencies as approximately 250 times the critical plasma density, and this result agrees very well with our theoretical assumptions. Four different foil thicknesses are simulated and the effects of foil thickness on γ photon emission and positron production are discussed. The results indicate that optimal foil thickness plays an important role in obtaining the desired γ photon and positron production according to the foil density and laser intensity. Further, a relation between the laser intensity and conversion efficiency is present for the optimal foil density and thickness.