What are the risks and drawbacks of storing sensitive data in external files and including them using PHP's include() function for website security?

Storing sensitive data in external files and including them using PHP's include() function can pose security risks as the files may be accessible to unauthorized users. To enhance website security, sensitive data should be stored securely, such as in a database, and accessed securely using proper authentication and authorization mechanisms.

// Example of securely accessing sensitive data from a database
$db_host = 'localhost';
$db_user = 'username';
$db_pass = 'password';
$db_name = 'database_name';

$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Use the $conn object to securely access sensitive data from the database