What best practices should be followed when including PHP scripts that use session_start() in a larger PHP file?

When including PHP scripts that use session_start() in a larger PHP file, it is important to ensure that session_start() is called only once in the entire script to prevent session-related issues. To achieve this, you can check if the session has already started before calling session_start() using session_status() function.

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

// Include PHP scripts that use session_start() here
include 'script1.php';
include 'script2.php';
// Continue with the rest of your code