0

My Craft files are structured correctly, I have the Craft file level with the public_html file on the server (which contains the index.php file), within index.php I have set my $craftpath correctly to $craftPath = '../craft';.

But when I go to my live url I get a Craft styled error of:

Service Unavailable
Our site is temporarily unavailable. Please try again later.

When I try to reach my admin I get an error of:

Error error
Craft can’t connect to the database with the credentials in craft/config/db.php.

If it helps, my general.php file looks like this:

return array(
    '*' => array(
        'omitScriptNameInUrls' => true
    ),

    // development
    'example.dev' => array(
        'environmentVariables' => array(
            'devMode' => true,
            'siteUrl'  => 'http://example.dev/',
            'assetPath' => 'http://example.dev/assets/'
        )
    ),

    // production
    'example.com' => array(
        'environmentVariables' => array(
            'devMode' => false,
            'siteUrl'  => 'http://example.com/',
            'assetPath' => 'http://example.com/assets/'
        )
    )
);

And the db.php file is as such:

return array(
    '*' => array (
        'tablePrefix' => 'craft',
    ),
    'example.dev' => array (
        'server' => 'localhost',
        'user' => 'root',
        'password' => 'root',
        'database' => 'localdatabase',
    ),
    'example.com' => array (
        'cooldownDuration' => 0,
        'server' => 'server',
        'user' => 'user',
        'password' => 'password',
        'database' => 'database',
    )
);

I hope you can help becuase I'm lossing my mind as to whats wrong, but I'm sure it's something minor that I'm overlooking.

  • The cooldownDuration setting should go in your general.php config file, not in your db.php config file. On your server, is the db on a separate server or is it on the same server? If so, the value for server in example.com should be localhost not server. – Steve Rowling Jul 19 '16 at 12:42
  • @SteveRowling: You should post that as an official answer, so Spheriri can accept it and others can upvote it. Great catch! – Lindsey D Jul 19 '16 at 15:35
5

The cooldownDuration setting should go in your general.php config file, not in your db.php config file. On your server, is the db on a separate server or is it on the same server? If so, the value for server in example.com should be localhost not server.

| improve this answer | |
  • Thank you SO MUCH Steve! It worked! Thought it would be a silly error somewhere. – Spheriri Jul 20 '16 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.