$_SERVER["HOME"] is undefined. I just used
parse_ini_file("../replica.my.cnf");Thanks! 2014-06-17 19:01 GMT+02:00 Maximilian Doerr <[email protected]>: > Something like > > <?php > > $db_mycnf = parse_ini_file($_SERVER['HOME']."/replica.my.cnf"); > > $db_username = $db_mycnf['user']; > > $db_password = $db_mycnf['password']; > > unset($db_mycnf); > > > > should do nicely. It’ll store the username and password to the variables > $db_username and $db_password. > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Emilio J. > Rodríguez-Posada > *Sent:* Tuesday, June 17, 2014 12:35 PM > *To:* Wikimedia Labs > *Subject:* [Labs-l] Connecting to MySQL in PHP > > > > Hello; > > I need to connect to a MySQL database using PHP. I have a replica.my.cnf > that I guess I have to use. What is the best way to connect to MySQL using > this file, without exposing the user/pass in the PHP code? > > There is no help about this in the tutorial.[1] > > Thanks > > [1] https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/Help > > _______________________________________________ > Labs-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/labs-l > >
_______________________________________________ Labs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/labs-l
