Page MenuHomePhabricator

mysqli: No way to specify the socket location
Closed, ResolvedPublic

Description

PHP mysql functions allow to specify the port number or socket location inside the hostname[1]. PHP mysqli functions don't, as they need to go in their own parameters[2]. This was fixed for the port number on bug 58153, but still there's no way to specify the socket location


[1] http://php.net/mysql_connect
[2] http://php.net/mysqli_real_connect


Version: 1.23rc
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=58153

Details

Reference
bz65998

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:21 AM
bzimport set Reference to bz65998.

Change 136638 had a related patch set uploaded by Martineznovo:
Make MySQLi work with non-standard socket

https://gerrit.wikimedia.org/r/136638

alastair wrote:

I have had a similar issue. On a managed server trying to indtall MW 1.22.7, I cannot connect to the DB.

On the command line, I have to use format :

mysql -u user -S /tmp/mysql5.sock -p database

But I cannot seem to use a "socket" format for the database name in setup e.g.

localhost:/tmp/mysql5.sock

Hopefully, this patch helps (I will see if I can try it).

Thanks Jesús Martínez Novo!

alastair wrote:

I tested the patched file DatabaseMysqli.php by overwriting the version in 1.22.7 (perhaps not ideal I know). File downloaded as :

https://git.wikimedia.org/raw/mediawiki%2Fcore/5ae151ff168a4596a235db766274df72f151e92f/includes%2Fdb%2FDatabaseMysqli.php

I am glad to say that I could install MW 1.22.7 by using the database name :

localhost:/tmp/mysql5.sock

So this patch fixed my immediate problem. Not sure on any side-effects it might have of course and I do not want to run this in production. So I will wait for release 1.23 and hope this makes it in.

Thanks again.

Change 136638 merged by jenkins-bot:
Make MySQLi work with non-standard socket

https://gerrit.wikimedia.org/r/136638

Merged for current master (1.24), I'll try to backport to 1.23

Change 160212 had a related patch set uploaded by Martineznovo:
Make MySQLi work with non-standard socket

https://gerrit.wikimedia.org/r/160212

^ this was the backport, but this is now fixed

Change 160212 merged by jenkins-bot:
Make MySQLi work with non-standard socket

https://gerrit.wikimedia.org/r/160212