The most common reason we hear is that the PS4 has been dropped or knocked while plugged in. This causes the HDMI cable to yank out and physically damage the port. It can also happen while plugging in the cable. The ports are quite delicate so if the HDMI cable isn't plugged in carefully to the PS4 it can cause damage.
If the port doesn't look damaged, there is another part of the motherboard that could have failed.
To repair this fault we need to carefully strip the console down to the motherboard. From there we desolder the old HDMI port. The port is attached by 4 main holding legs that are through-hole soldered and the HDMI data pins are surface mounted so it is a delicate job. Once the old port is removed, the solder pads of the logic board are inspected for damage. If the original port is really badly yanked, this can cause damage to the motherboard and in some circumstances could be beyond repair (although that is very rarely the case).
Once we have cleaned up the board and prepped the solder pads for the new port, we solder the new HDMI port to the PS4. We reassemble the console and it goes down to our testing bench where all consoles are tested for at least 4 hours.