What are the potential risks of storing database credentials in a PHP file like config.php?
Storing database credentials in a PHP file like config.php can pose a security risk if the file is accessible to unauthorized users. To mitigate this risk, it is recommended to store the credentials outside of the web root directory and restrict access to the file using appropriate file permissions.
<?php
// config.php
define('DB_HOST', 'localhost');
define('DB_USER', 'username');
define('DB_PASS', 'password');
define('DB_NAME', 'database_name');
?>