Connection failed: 2002) No such file or directory

Recommend this page to a friend!

      JavaScript Cryptographic Chat  >  All threads  >  Connection failed: 2002) No such...  >  (Un) Subscribe thread alerts  
Subject:Connection failed: 2002) No such...
Summary:error: Connection failed: 2002) No such file or directory
Messages:4
Author:Matthew
Date:2016-08-03 14:00:07
 

  1. Connection failed: 2002) No such...   Reply   Report abuse  
Picture of Matthew Matthew - 2016-08-03 14:00:07
Hi

Can you tell what usually causes this, "Connection failed: 2002) No such file or directory", upon installation.

Details: I created a new database; adjusted the install.php, classes/cchat.class.php, index.php; then uploaded everything to my webhost; and went to that page /cchat; error.

  2. Re: Connection failed: 2002) No such...   Reply   Report abuse  
Picture of Martin Latter Martin Latter - 2016-08-03 16:54:34 - In reply to message 1 from Matthew
Hello Matthew,

That's a message I haven't encountered before.

Can you first try to run cchat on a local server to isolate the problem from the remote server? You also won't need to create a new database if you run the install script, as that creates a database and user.

I've just run the following as a new install, with no issues and messaging operating between browser tabs, on a Debian-based PC:

cd <to server's web directory>

sudo git clone https://github.com/Tinram/cchat.git
# the original source I maintain; just in case something has gone wrong on import/download in JS Classes

sudo chown -R <your_user_name>:www-data cchat
# if on a non-Ubuntu/Debian distro substitute 'www-data' for 'apache' etc

# add the MySQL root password to install.php:
define('ROOT_PASSWORD', '**password**');
# save install.php

# in a browser go to:
localhost/cchat/install.php

# then go to:
localhost/cchat/

If this works on a local Linux or Windows server, good.
Then you should be able to repeat these steps on the remote server (if Git is installed and you know the MySQL root password). If Git is unavailable, just extract the Zip contents to an appropriate directory and follow all the other steps.

Hope this can help.

  3. Re: Connection failed: 2002) No such...   Reply   Report abuse  
Picture of Matthew Matthew - 2016-08-03 22:31:20 - In reply to message 2 from Martin Latter
Found the problem:

My webhost is not known as localhost. That's been hard-coded in the classes/cchat.class.php. So I added DB_HOST as a const, then I changed line#39 (now #40) (in getConnection()) to "...= new mysqli(self::DB_HOST, self::DB_..." (added the const, instead of the word 'localhost'). Now I can specify the host name, along with the DB user, pass, etc.

Stumbled on it to by changing the database host to "localhost" in another configuration file of a working and installed app.

But that only 1 in 10000 change - mostly the database host is called "localhost"!

  4. Re: Connection failed: 2002) No such...   Reply   Report abuse  
Picture of Martin Latter Martin Latter - 2016-08-04 19:23:06 - In reply to message 3 from Matthew
I'm too used to everything being a localhost connection ...

That's a good find, thank you.

I've updated GitHub with revised connections.
These changes should be imported into JS Classes within a day or so.