Are there any best practices for handling session_start in PHP to avoid errors like "A session had already been started"?

When using session_start() in PHP, it is important to ensure that it is only called once per session. To avoid errors like "A session had already been started", you can check if a session has already been started before calling session_start().

if(session_status() == PHP_SESSION_NONE) {
    session_start();
}