It\'s always bothered me that many PHP programs require the user to store the mysql password in plain text (in a string or constant) in a configuration file in the applicati
Since your code will need the password there is no perfect security. But you can make it hard to recover.
I put some hash in my web config, as an environment variable, say MYSQL_PASS_HASH
Then I do something like md5(getenv('MYSQL_PASS_HASH').'gibberish$qwefsdf') which is then the password. Of course you should unsetenv after that if you're paranoid.
Your password will not literally be stored somewhere, and it can be recovered only when someone has both you web config and your database include.
This happens in a file outside of the webroot (don't put all your trust in .htaccess).