What are the potential security risks of hardcoding passwords in PHP scripts?
Hardcoding passwords in PHP scripts poses a significant security risk as it exposes sensitive information in plain text. To mitigate this risk, passwords should be stored securely, such as in a configuration file outside of the web root directory, or using environment variables.
// Store the password in a configuration file outside of the web root directory
$config = parse_ini_file('/path/to/config.ini');
$password = $config['password'];