How can PHP developers protect sensitive data, such as passwords, in configuration files from being accessed by unauthorized users?

To protect sensitive data like passwords in configuration files, PHP developers can store the data in a separate file outside the web root directory and use environment variables to access them securely. This way, the sensitive information is not accessible to unauthorized users who may try to access configuration files directly.

```php
// config.php
define('DB_HOST', getenv('DB_HOST'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASS', getenv('DB_PASS'));
define('DB_NAME', getenv('DB_NAME'));
```

In this example, sensitive data such as the database host, username, password, and database name are stored in environment variables and accessed securely in the PHP application.