What are the potential risks of storing sensitive information, such as passwords, directly in PHP files?

Storing sensitive information, such as passwords, directly in PHP files can pose a security risk as the information can be easily accessed if the file is compromised. To mitigate this risk, it is recommended to store sensitive information in a separate configuration file outside of the web root directory and restrict access to it.

// config.php
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'username');
define('DB_PASS', 'password');
define('DB_NAME', 'database');
?>
```

Include the configuration file in your PHP scripts where needed:

```php
// index.php
<?php
require_once('config.php');

// Use the defined constants for database connection
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
?>