Jump to content

$config->dbSocket is not handled in WireDatabasePDO.php


interrobang
 Share

Recommended Posts

Today I had to deploy a site to a server which uses a socket for connecting to mysql. It seems socket support is not handled in WireDatabasePDO. Inserting 2 lines in the WireDatabasePDO::getInstance method fixed it:

		$host = $config->dbHost;

$username = $config->dbUser;

$password = $config->dbPass;

$name = $config->dbName;

$port = $config->dbPort;

// get socket from $config:

$socket = $config->dbSocket;

$dsn = "mysql:dbname=$name;host=$host";

if($port) $dsn .= ";port=$port";

// if socket is provided ignore $host and $port and use $socket instead:

if ($socket) $dsn = "mysql:unix_socket=$socket;dbname=$name;";

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...