I’ll deal with the case of monomorphisms. A dual argument works for epimorphisms.
For an abelian category, what you ask about is true, since $\phi$ has a kernel $\ker(\phi_1)\to\ker(\phi_2)$, which is zero iff $\phi_1$ and $\phi_2$ are monomorphisms.
For a general category it’s not true. Take the simplest category with a non-monomorphism: there are precisely three objects $X$, $Y$ and $Z$ with two maps $\alpha,\beta:X\to Y$ and one map $\gamma:Y\to Z$ such that $\gamma\alpha=\gamma\beta$ and no other maps except identity maps. So $\gamma$ is not a monomorphism.
However consider the map of morphisms $\phi$ from $\alpha$ to $\gamma$ with $\phi_1=\alpha$ and $\phi_2=\gamma$.
This is a monomorphism, since no object of the morphism category has more than one map to $\alpha$.