We propose a scheme to realize controlled phase-flip gate between two single photons through a single quantum dot (QD) in a slow-light photonic crystal (PhC) waveguide. Enhanced Purcell factor and large β-factor lead to high gate fidelity over broadband frequencies compared to cavity-assisted system. The excellent physical integration of this PhC waveguide system provides tremendous potential for large-scale quantum information processing. Then we generalize to a multi-atom controlled phase-flip gate based on waveguide system in Sagnac interferometer. Through the Sagnac interferometer, the single photon adds the phase-flip operation on the atomic state without changing the photonic state. The controlled phase-flip gate on the atoms can be successfully constructed with high fidelity in one step, even without detecting the photon.