[Labs-l] Connecting to MySQL in PHP

Tim Landscheidt tim at tim-landscheidt.de
Wed Jun 18 00:11:51 UTC 2014


Emilio J. Rodríguez-Posada <emijrp at gmail.com> wrote:

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

> [...]

If you want to "totally future-proof" your script, you could
also use (rephrased from
https://wiki.toolserver.org/view/Database_access#PHP):

| $userinfo = posix_getpwuid(posix_getuid());
| $homedir  = $userinfo['dir'];

This will always return the home directory of the account
the script is running as.  However, if we would ever decide
to move the home directories around, you could probably not
miss the pandemonium :-).

Tim




More information about the Labs-l mailing list