Jump to content

Installation error: Unknown MySQL server host 'Config'


sbarner
 Share

Recommended Posts

I've tried installing ProcessWire twice (via git) on a production CentOS server to which I have complete access.  Both times the installation script seems to run fine, but in the end when I try to view the site or login I get this error:

Error Exception: DB connect error 2005 - Unknown MySQL server host 'Config' (1) (in /www/<server name removed>/ProcessWire/wire/core/ProcessWire.php line 96)

From what I can see, line 96 starts with "throw New WireDatabaseException" and had no reference to Config.

Can anyone provide some direction on how to troubleshoot this?

Thanks,

Steve

Link to comment
Share on other sites

Hi steve and welcome!

Sounds like for some reason the Database Host is not recognized.

Can you check those database settings in /site/config.php (at the bottom of the file):

Is everything correct there?

$config->dbHost = '';
$config->dbName = '';
$config->dbUser = '';
$config->dbPass = '';
$config->dbPort = '';
  • Like 2
Link to comment
Share on other sites

Here are the settings from config.php:

$config->dbHost = 'localhost';$config->dbName = 'pw';$config->dbUser = 'pw';$config->dbPass = ''; /** Removed */$config->dbPort = '3306';

I checked and mysqld is running and the installer did not complain about not being able to reach the database.

Link to comment
Share on other sites

Steve, your config.php looks pretty much as would be expected. Does your mySQL setup use 'localhost' etc? I have seen setups where you need to connect via a db name and a system username, rather than the usual stuff.

What mySQL & PHP versions are you on?

Link to comment
Share on other sites

PHP is version 5.3.3, MySQL is 5.1.67, and the MySQL port number is 3306.  I checked and the mysqld process is indeed listening on that port.

I don't think the firewall is open for port 3306, but I was thinking it didn't need to be, since everything is happening locally except the client browser access.  Do I need to open the firewall on that port?

Thanks

Link to comment
Share on other sites

I'm able to reproduce that error message, but only with a broken config. If $config-variable is an object but $config->dbHost evaluates to false, I'm facing the same message (this piece of code here: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Database.php#L62). It's a Config-object represented as a string --> 'Config'.

@sbarner: So, are you certain you've got exactly this in your config? It's case-sensitive ("dbHost" I mean).


$config->dbHost = 'localhost';

And there's nothing else affecting $config->dbHost after that? One possibility would be an if-clause with assignment instead of comparison, something like this:


// this would break things up!
if($config->dbHost = '') {
  // do something different for one environment, or whatever
}
  • Like 1
Link to comment
Share on other sites

First confirm that you can resolve localhost. From a shell prompt,  ping localhost. If you don't resolve the name, confirm that there is an entry in /etc/hosts

If localhost resolves, and the MySQL server is running, validate a db connection by simply using the mySQL command line client. 

$> mysql -h host -u user -p 

Where host is localhost and user is a valid user account.  Can you connect?

If you can connect, can you use the DB you created for ProcessWire?

Following this procedure would isolate the issue. 

  • Like 1
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...