Zend certified PHP/Magento developer

Best practice for storing database login info?

I’m currently at University so I’m by no means a professional.

I’m working on a PHP app that connects to a database. In one of my PHP files, I have details stored in variables such as the below examples:

“localhost” “username” “password” “database name”

Surely it is unsafe to store this information in a PHP file? Someone could look at the page source and see it, right?

Is there a better, more common practice way to securely store these values elsewhere and then pull them in for the database connection?

submitted by /u/seanmacthomais
[link] [comments]