[Labs-l] Connecting to MySQL in PHP
maximilian.doerr at gmail.com
Tue Jun 17 17:01:43 UTC 2014
$db_mycnf = parse_ini_file($_SERVER['HOME']."/replica.my.cnf");
$db_username = $db_mycnf['user'];
$db_password = $db_mycnf['password'];
should do nicely. It’ll store the username and password to the variables $db_username and $db_password.
From: labs-l-bounces at lists.wikimedia.org [mailto:labs-l-bounces at lists.wikimedia.org] 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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Labs-l