[Labs-l] Connecting to MySQL in PHP

Maximilian Doerr maximilian.doerr at gmail.com
Tue Jun 17 17:34:19 UTC 2014


That works too.  The end result is what mostly counts. J

 

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 1:32 PM
To: Wikimedia Labs
Subject: Re: [Labs-l] Connecting to MySQL in PHP

 

$_SERVER["HOME"] is undefined. I just used parse_ini_file("../replica.my.cnf");

Thanks!

 

2014-06-17 19:01 GMT+02:00 Maximilian Doerr <maximilian.doerr at gmail.com>:

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: 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

 

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
Labs-l at lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/labs-l

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/labs-l/attachments/20140617/13123c94/attachment.html>


More information about the Labs-l mailing list