Recently I installed mysql in my /home directory and began to setup phpMyAdmin when I realized that it was missing support for an alternative 'socket' connect, which is necessary to point to any other mysql server than the main mysql server on the machine. I have added a patch to version 2.2.0-rc3 that I downloaded just yesterday. I am not an expert at using diff, but I did run diff -Nuar and here are the results for lib.inc.php and config.inc.php. I would really like this to be added to the main tree, so if anyone likes the idea but hates the way I send it, please e-mail me at: bigredlinux at yahoo dot com to get me on the right track because I have lots of these patches.
--- phpMyAdmin2.2.0rc3/lib.inc.php Sat Jul 21 22:02:59 2001 +++ phpMyAdmin/lib.inc.php Tue Aug 7 23:27:27 2001 @@ -222,9 +222,19 @@ auth(); } else { if(empty($cfgServer['port'])) { - $dbh = $connect_func($cfgServer['host'],$cfgServer['stduser'],$cfgServer['stdpass']) or mysql_die(); + // Check for socket + if(empty($cfgServer['socket'])) { + $dbh = $connect_func($cfgServer['host'],$cfgServer['stduser'],$cfgServer['stdpass']) or mysql_die(); + } else { + $dbh = $connect_func($cfgServer['host'] . ':' . $cfgServer['socket'],$cfgServer['stduser'],$cfgServer['stdpass']) or mysql_die(); + } } else { - $dbh = $connect_func($cfgServer['host'].":".$cfgServer['port'],$cfgServer['stduser'],$cfgServer['stdpass']) or mysql_die(); + // Check for socket + if(empty($cfgServer['socket'])) { + $dbh = $connect_func($cfgServer['host'].":".$cfgServer['port'],$cfgServer['stduser'],$cfgServer['stdpass']) or mysql_die(); + } else { + $dbh = $connect_func($cfgServer['host'].":".$cfgServer['port'].':'.$cfgServer['socket'],$cfgServer['stduser'],$cfgServer['stdpass']) or mysql_die(); + } } $PHP_AUTH_USER = addslashes($PHP_AUTH_USER); $PHP_AUTH_PW = addslashes($PHP_AUTH_PW); @@ -303,12 +313,23 @@ $cfgServer['user']=$PHP_AUTH_USER; $cfgServer['password']=$PHP_AUTH_PW; } - - if (empty($cfgServer['port'])) { - $link = $connect_func($cfgServer['host'], $cfgServer['user'], $cfgServer['password']) or mysql_die(); + + if(empty($cfgServer['port'])) { + // Check for socket + if(empty($cfgServer['socket'])) { + $link = $connect_func($cfgServer['host'],$cfgServer['user'],$cfgServer['password']) or mysql_die(); + } else { + $link = $connect_func($cfgServer['host'] . ':' . $cfgServer['socket'],$cfgServer['user'],$cfgServer['password']) or mysql_die(); + } } else { - $link = $connect_func($cfgServer['host'].":".$cfgServer['port'], $cfgServer['user'], $cfgServer['password']) or mysql_die(); + // Check for socket + if(empty($cfgServer['socket'])) { + $link = $connect_func($cfgServer['host'].":".$cfgServer['port'],$cfgServer['user'],$cfgServer['password']) or mysql_die(); + } else { + $link = $connect_func($cfgServer['host'].":".$cfgServer['port'].':'.$cfgServer['socket'],$cfgServer['user'],$cfgServer['password']) or mysql_die(); + } } + } else{ echo $strHostEmpty;
--- phpMyAdmin2.2.0rc3/config.inc.php Sat Jul 21 22:02:58 2001 +++ phpMyAdmin/config.inc.php Tue Aug 7 23:37:16 2001 @@ -23,6 +23,7 @@ // You can disable a server config entry by setting host to ''. $cfgServers[1]['host'] = 'localhost'; // MySQL hostname $cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port +$cfgServers[1]['socket'] = ''; // MySQL socket - leave blank for default socket $cfgServers[1]['adv_auth'] = false; // Use advanced authentication? $cfgServers[1]['stduser'] = ''; // MySQL standard user (only needed with advanced auth) $cfgServers[1]['stdpass'] = ''; // MySQL standard password (only needed with advanced auth) @@ -33,8 +34,9 @@ $cfgServers[1]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support $cfgServers[1]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support
-$cfgServers[2]['host'] = ''; +$cfgServers[2]['host'] = 'localhost'; $cfgServers[2]['port'] = ''; +$cfgServers[3]['socket'] = ''; $cfgServers[2]['adv_auth'] = false; $cfgServers[2]['stduser'] = ''; $cfgServers[2]['stdpass'] = ''; @@ -62,7 +64,7 @@ // or set it to 0 to be given a list of servers without logging in // If you have only one server configured, $cfgServerDefault *MUST* be // set to that server. -$cfgServerDefault = 1; // Default server (0 = no default server) +$cfgServerDefault = 0; // Default server (0 = no default server) $cfgServer = ''; unset($cfgServers[0]);
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
On Wed, Aug 08, 2001 at 10:33:34AM -0700, Dan Allen wrote:
on the machine. I have added a patch to version 2.2.0-rc3 that I downloaded just yesterday. I am not an expert at using diff, but I did run diff
Thanks for your patches and suggestions!
the best would be that you send diffs based on the latest CVS version : rc3 is quite outdated, and the things are moving quite quickly.
Olivier