Here are some of the most common reasons why you do not appear online on PS4:
The PSN (PlayStation Network) is not available.
Your PS4's DNS setup is incorrect.
Internet connectivity was lost on your Wi-Fi network.
The wireless router is too far from your PS4, causing intermittent signal loss.