First off, I'm trying to make sure that I'm not showing my MySQL password in my index page's source code. I've determined that making a "mysql.conf" file with the information I need will be sufficient.
Here is the section of code, pre-conf file. This worked without any problems:
$dbhost = "mysql.host.com";
$dbuser = "username";
$dbpass = "password";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
Now, here is the configuration file's contents (mysql.conf):
mysql.host.com
username
password
And the corresponding changes to the code...
$dbConfig = file("./config/mysql.conf");
$dbhost = $dbConfig[0];
$dbuser = $dbConfig[1];
$dbpass = $dbConfig[2];
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
However, with the changes to use the configuration file, the MySQL connection now fails, giving me this error response:
"Could not connect: Access denied for user 'username'@'chain-lightning.dreamhost.com' (using password: YES)"
What am I missing? I've triple-checked that the text in the configuration file is the same as when I used static strings. Thanks!