<p>The <code>cooldownDuration</code> setting should go in your <code>general.php</code> config file, not in your <code>db.php</code> 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 <code>localhost</code> not <code>server</code>.</p>

CC BY-SA 3.0
2016-07-20T21:16:47.737Z
Thank you SO MUCH Steve! It worked! Thought it would be a silly error somewhere.
Spheriri
CC BY-SA 3.0
2016-07-19T16:16:55.127Z
2016-07-19T16:16:55.127Z
Steve Rowling
<p>My Craft files are structured correctly, I have the Craft file level with the <code>public_html</code> file on the server (which contains the <code>index.php</code> file), within <code>index.php</code> I have set my <code>$craftpath</code> correctly to <code>$craftPath = '../craft';</code>.</p>

<p>But when I go to my live url I get a Craft styled error of: </p>

<pre><code>Service Unavailable
Our site is temporarily unavailable. Please try again later.
</code></pre>

<p>When I try to reach my admin I get an error of:</p>

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

<p>If it helps, my general.php file looks like this: </p>

<pre><code>return array(
    '*' =&gt; array(
        'omitScriptNameInUrls' =&gt; true
    ),

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

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

<p>And the db.php file is as such:</p>

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

<p>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.</p>

CC BY-SA 3.0
2016-07-19T12:42:51.097Z
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
CC BY-SA 3.0
2016-07-19T15:35:02.933Z
@SteveRowling: You should post that as an official answer, so Spheriri can accept it and others can upvote it. Great catch!
Lindsey D
<config>
Craft can't connect to db.php on live server
# Craft can't connect to db.php on live server

(Asked by: username_0 on 2016-07-19)

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.

**Tags:** config

> **Comments:**
> **username_1**: 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`.  
> **username_2**: @SteveRowling: You should post that as an official answer, so username_0 can accept it and others can upvote it. Great catch!  

---

## 1 answers

### Answer by username_1 on 2016-07-19. Score: 5 | Accepted answer

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`.

> **Comments:**
> **username_0**: Thank you SO MUCH Steve! It worked! Thought it would be a silly error somewhere.  

---

