What are some best practices for handling configuration settings in PHP applications to ensure security and maintainability?

Issue: Storing configuration settings in PHP applications can pose security risks if sensitive information such as database credentials or API keys are exposed. To address this, it is recommended to store sensitive configuration settings in a separate file outside of the web root directory and restrict access to it.

// config.php file
define('DB_HOST', 'localhost');
define('DB_USER', 'username');
define('DB_PASS', 'password');
define('DB_NAME', 'database_name');
```

```php
// index.php file
require_once 'config.php';

// Use the defined constants to access configuration settings
$connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);