Or is it for photon (1) doesn't work?
The four-momentum for a massive particle is
$$p^\mu = mU^\mu$$
where
$$U^\mu=\frac{dx^\mu}{d\tau}$$
is the (time-like) four-velocity of the particle (the unit tangent vector of the particle's time-like world line). The components of the four-momentum are
$$m(\gamma c, \gamma \vec v) = (E/c, \gamma m \vec v)$$
Note carefully that the 'length' of the (time-like) four-momentum is (proportional to) the rest energy - the time component of the four-momentum in a coordinate system in which the particle is at rest
$$p_\mu p^\mu = m^2\left((\gamma c)^2 - (\gamma v)^2 \right) = (mc)^2 = (E_0/c)^2$$
from which we get the relativistic energy-momentum relationship
$$(E/c)^2 - \gamma^2 m^2 v^2 = (E_0/c)^2 \rightarrow E^2 = (pc)^2 + (E_0)^2 = (pc)^2 + (mc^2)^2 $$
However, the world line of a photon is light-like (null) and thus there is no four-velocity for a photon; $U^\mu$ does not exist for a null world-line.
Nonetheless, the (light-like) four-momentum for a photon exists and is given by
$$p^\mu = (E/c,\vec p)$$
and since it is light-like, its 'length' is zero (null)
$$p_\mu p^\mu = (E/c)^2 - p^2 = 0 \rightarrow E^2 = (pc)^2$$