[phpMyAdmin Developers] Default host name with different connect types

Michal Čihař michal at cihar.com
Thu Feb 2 16:11:25 CET 2017


Isaac Bennetch píše v St 01. 02. 2017 v 17:10 -0500:
> When a user does not define `$cfg['Servers'][$i]['host']` but does
> set `$cfg['Servers'][$i]['connect_type']  = 'tcp';`, the default
> host of 'localhost' is used, forcing the connection over socket
> because of how MySQL interprets the host.
> 
> Would it be helpful to detect when the user specifies 'tcp' and use a
> default host of '127.0.0.1' instead of 'localhost', or is that
> getting to be too much guessing about what the user wants?

I'm not really sure, but this would probably get tricky - what to do if
user does set host to localhost and connect_type to tcp?


Looking at our code, the connect_type is really not used much:

- if it is set to tcp, the socket is set to empty, what is not
necessary according to http://php.net/mysqli_connect

- if it set to tcp and host is empty error is raised, I'm not sure if
special case here is needed, MySQL will fail as well

- sets server verbose name for socket connection, see https://github.co
m/phpmyadmin/phpmyadmin/issues/6878


Overall I don't think this parameter actually makes sense - so how
about removing it completely?

See https://github.com/phpmyadmin/phpmyadmin/pull/12950


-- 
	Michal Čihař | https://cihar.com/ | https://weblate.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.phpmyadmin.net/pipermail/developers/attachments/20170202/2be3c7f3/attachment.sig>


More information about the Developers mailing list