Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database connection problem
09-11-2020, 01:46 AM,
Database connection problem
Hello, having installed webERP, I was unable to log in - the result was always a message

"Connect failed: No such file or directory"

Eventually traced this to the initial mysqli_connect() call, where I put in some debugs to verify that this function was being passed the expected arguments, then suddenly remembered a previous problem I had with mysqli - the solution was to change config.php so that the host is specified not as 'localhost', but as ''. I think this is something to do with the fact that I am using a non-standard port for the mySQL server; as a consequence, by specifying '' it forces the function to actually use the port argument: otherwise it merrily ignores it and uses the socket instead.

There are probably other ways to solve the problem! Thought it was worth raising the matter in case anyone else encounters the isssue, or has a better way of resolving it.
09-13-2020, 06:51 AM, (This post was last modified: 09-13-2020, 09:26 AM by TurboPT.)
RE: Database connection problem
Yes, I've seen a few others (not here, but elsewhere, such as stackoverflow as one example) about the localhost/ difference with connectivity.

Not sure how/what makes the difference, many have claimed that it works using either one, so there must be configuration aspect somewhere.
09-13-2020, 07:16 AM,
RE: Database connection problem
From :

"Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "" instead of "localhost". If the MySQL client library tries to connect to the wrong local socket, you should set the correct path as in your PHP configuration and leave the server field blank."

My understanding is that localhost and are different. Using localhost the OS will use an internal socket to connect, but the PHP mysqli library will assume you are using the standard port. If you use then you will use TCP/IP sockets as if it were an external server it was connecting to, and you can use any port.

Using localhost is quicker as the internal OS socket will be faster than the TCP/IP ones, but you cannot use it if you want to use a non standard port.

Hope I haven't just confused people more
09-13-2020, 09:26 AM,
RE: Database connection problem
That makes sense to me, thanks for the find, Tim.

Forum Jump:

Users browsing this thread: 1 Guest(s)