Quantum phase gate operation based on nonlinear optics: Full quantum analysis