WebSite X5Help Center

 
Peter W.
Peter W.
User

Unable to connect to DB error, when using Dynamic Content Object.  en

Author: Peter W.
Visited 2837, Followers 2, Shared 0  

I have just upgraded my root webserver to a new installation based on Ubuntu 16.04.2 LTS and Plesk Onyx v17.0.17. I am using Website X5 13 Pro.

I have a number of websites that make use of Dynamic Objects and they worked perfectly, before. Now I am getting the error "Unable to connect to DB" wherever those objects are.

Even the admin area does not work with the same error.

Obviously some service is not working on the server, that is needed and causing these problems. Can someone help me fix these problems, as I cannot use any of my websites properly until this is fixed.

Example website.

https://www.stnv.de/en/news-intro.php

A different language version of that website has not yet been upgraded to v13, and strangely the problem does not occur there (made with X5 12 Pro).

https://www.stnv.de/de/news-intro.php

How can I get this working under v13 Pro?

Posted on the
9 ANSWERS - 1 CORRECT
Incomedia
Riccardo P.
Incomedia

Hello Peter,

verify that the server support the PHP 5.x and check the connection data to Database.

Let me know.

Read more
Posted on the from Riccardo P.
Peter W.
Peter W.
User
Author

As you can see here, I am using PHP 5.6.31
http://www.stnv.de/en/phpinfo.php

The website test on the German admin area has a pass on every line. All the same, I cannot get the v13 pro version to work.

Read more
Posted on the from Peter W.
Peter W.
Peter W.
User
Author

I also tried PHP 7.0.18. The v12 version of the website worked fine with that, but v13 had the same problems.

I have switched the website back to PHP 5.6.31 and still get "Unable to connect to DB"

Read more
Posted on the from Peter W.
Peter W.
Peter W.
User
Author

I have solved the problem. I checked the server and found that the cause of this issue was an incorrect set up of the MySQL Server. In /etc/mysql/my.cnf, the bind-address was configured so that MySQL could only listen on the localhost port, refusing any outbound connections. I have modified the file and MySQL now accepts connections from outside.

# grep bind /etc/mysql/my.cnf
# bind-address = 127.0.0.1
# bind-address = 0.0.0.0

This might be of interest to anyone else who has these problems.

On a side note, it appears that WebsiteX5 13 Professional Dynamic opjects rely on being accesible publically instead of via localhost. Maybe the software should consider checking localhost as well before declaring no contact possible with the database.

Read more
Posted on the from Peter W.
Peter W.
Peter W.
User
Author

Sorry, that answer was confusing. It should look like this:

#bind-address = 127.0.0.1
bind-address = 0.0.0.0

Read more
Posted on the from Peter W.
Incomedia
Riccardo P.
Incomedia

Hello Peter,
thank you for your feedback. If you use a web server you need to set correctly the local web server on the pc and write in the step 1 of WebSite X5 (in the site url) the URL of your local site.

Read more
Posted on the from Riccardo P.
Peter W.
Peter W.
User
Author

I am still having problems, but they are now somewhat different. 
I have access to https://www.stnv.de/en/admin/login.php 

Reserved Access displays the automatic registrations made in the past (before the server change)
Dynamic Content shows the texts properly (and editing those texts online works)
Website Test gives a Pass on all lines. 
I tried to send test an email using PHP Mailer (SMTP) which did not work - no error message, nothing arrived.
A test email using PHP Mailer (not SMTP) did arrive.

I have a reserved area with automatic registration:
https://www.stnv.de/en/insider-fan-area.php

Existing members can login, without problems. 
Registering a new account appears to work. A new user can fill in the details and click on Register.
A message appears: "We have sent you an e-mail to validate your account."

But no emails are sent and there is no new entry made to the database. A major problem.

I have tried with PHP 5.6.31 and 7.0.18

I looked in the logs and saw messages like this:
[Sun Aug 06 07:34:20.269247 2017] [fcgid:warn] [pid 22126:tid 139987111802624] [client 180.76.15.156:35543] mod_fcgid: stderr: PHP Warning:  mysqli::mysqli(): (HY000/2002): No such file or directory in /var/www/vhosts/stnv.de/httpdocs/en/res/x5engine.php on line 3908

Line 3908 contains this line:
      $this->db = new mysqli($host, $user, $pwd);

So for some reason, an attempt to write to the database results in a file not being found, yet the database can be read in admin. The database is setr for read/write access.

What can I do to get this working?

Read more
Posted on the from Peter W.
Incomedia
Riccardo P.
Incomedia

Hello Peter,

Verify that the tables are correctly permission in reading and writing and the server support the InnoDB.

Maybe the email is sent but it is put in the spam folder.

I suggest you to try in another server, try on the One.com (https://helpcenter.websitex5.com/it/community/utenti/6528/webhosting)

Let me know.

Read more
Posted on the from Riccardo P.
Peter W.
Peter W.
User
Author

Thanks, after a lot of analyzing, the problem was that when I restored the raw MySQL database files back to the server, some of them had not been given the correct permissions. After I set them all to mysql:mysql, everything started to work again. 

Read more
Posted on the from Peter W.