Ticket #570 (closed Bug: duplicate)

Opened 3 years ago

Last modified 2 years ago

Unix domain sockets don't work

Reported by: geocar Owned by:
Priority: major Milestone:
Component: Core Keywords:
Cc: Sensitive:

Description

I want to use a unix-domain socket that was different than the output of mysql_config --socket on the machine where PHP was installed.

localhost;unix_socket=/home/myusername/mysql/socket

Install proceeds otherwise uneventfully, and then bombs out when I first visit it with a complaint:

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Change History

Changed 3 years ago by vipsoft

  • status changed from new to closed
  • resolution set to invalid

Thank you for your interest in Piwik. However, we can't provide this level of MySQL support. Please try the MySQL forums.

Changed 3 years ago by geocar

  • status changed from closed to reopened
  • resolution invalid deleted

If I edit the config/config.ini.php and put double-quotation marks around the host line:

host = "localhost;unix_socket=/home/myusername/mysql/socket"

then Piwik can connect to the MySQL server. However, when Piwik rewrites the configuration file it quickly reverts back to:

host = localhost;unix_socket=/home/myusername/mysql/socket

which is parsed as:

host = localhost

Line 128 of core/Config.php indicates you've already dealt with this problem for another key. Please encapsulate any field with an embedded ; character. My proof-of-concept looks like this:

if (strpos($value, ';') !== false) {

$value = '"'.$value.'"';

} else

although I'd recommend that Piwik actually escape values and handle strings of any type.

Changed 3 years ago by vipsoft

  • status changed from reopened to closed
  • resolution set to duplicate

Rolled requirements into #481 (username should be in quotes).

Changed 3 years ago by geocar

thanks

Changed 3 years ago by vipsoft

see also #614

Changed 2 years ago by spomoni

Note: See TracTickets for help on using tickets.