According to the PDO documentation, you can store database login details in php.ini, away from the php file (example 3). But it does not explain how to store username and password, only the database and host. How would you do that?
This is the method used in the documentation:
[PDO]
pdo.dsn.mydb="mysql:dbname=testdb;host=localhost"
I've tried adding the username and password to the host, but it does not like : between the username and password, and it does not recognize an address with only a username as a real address:
[PDO]
pdo.dsn.mydb="mysql:dbname=testdb;host=username:password@localhost"
I've also tried putting the username and password as separate arguments, but it does not.s
[PDO]
pdo.dsn.mydb="mysql:dbname=testdb;host=localhost;username:username;password:secret"
pdo.dsn.mydb="mysql:dbname=testdb;host=localhost;uid:username;pwd:secret"
pdo.dsn.mydb="mysql:dbname=testdb;host=localhost;UID:username;PWD:secret"