Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Rebuild _config.php

Go to End

6 Posts   2827 Views


Community Member, 63 Posts

7 August 2009 at 12:06am


I am new to SilverStripe and like it so far.

On a live website, I (accidentally) overwrote the site/_config.php file and the website no longer works properly.
Website is here

How do I rebuild/replace the _config.php file?
(This is the main site one that is located in the root directory.)

Needless to say I feel a total clown, and now require help.



Community Member, 63 Posts

7 August 2009 at 1:19am

Oops. Panicking I rushed into to post early.

Got it fixed. The _config.php file was not overwritten as it was in the /mysite/ directory.
It was something else that was wrong and now sorted.



Community Member, 8 Posts

20 July 2010 at 4:01pm

I actually did make this mistake and was wondering if anyone knew the answer to this. I copied and pasted a sample _config.php and my site went from redirect loop to website error. Still not functional, but better than previously. I have tried dev/build but I'm just getting the error screen over and over again. Here is what my config file looks like now:


global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
"type" => "MySQLDatabase",
"server" => "localhost",
"username" => "root",
"password" => "root",
"database" => "SS_mysite",


// enable nested URLs for this site (e.g. page/sub-page/)

// This line set's the current theme. More themes can be
// downloaded from


What needs to be fixed? Thanks.


Community Member, 181 Posts

20 July 2010 at 7:21pm

What do you mean by "website error" exactly?

step 1. add


This will give you more meaningful errors.

step 2. change the theme to blackcandy to rule out errors in your theme.

step 3. if you've changed it, go back to the default Page.php

If it's still not working, you should at least have some more detailed errors ;)



Community Member, 8 Posts

24 July 2010 at 2:37pm

Ok, I added the set environment and now this is what I get:


[Warning] mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES)
GET /silverstripe/Page.php

Line 57 in /home/cnwcentr/public_html/ren/silverstripe/sapphire/core/model/MySQLDatabase.php


48 * Connect to a MySQL database.
49 * @param array $parameters An map of parameters, which should include:
50 * - server: The server, eg, localhost
51 * - username: The username to log on with
52 * - password: The password to log on with
53 * - database: The database to connect to
54 * - timezone: (optional) the timezone offset, eg: +12:00 for NZ time
55 */
56 public function __construct($parameters) {
57 $this->dbConn = mysql_connect($parameters['server'], $parameters['username'], $parameters['password']);
59 if(self::$connection_charset) {
60 $this->query("SET CHARACTER SET '" . self::$connection_charset . "'");
61 $this->query("SET NAMES '" . self::$connection_charset . "'");
62 }

Line 57 of MySQLDatabase.php
Line 94 of DB.php
Line 121 of main.php


Since I'm new to php and css, unfortunately I don't know what any of this means. But does this give people a better idea of what I should be doing to get the site to work normally again?


Community Member, 181 Posts

24 July 2010 at 3:04pm

That's telling you the user for connecting to the database is wrong. It's a default MySQL setting that user "root" is disabled. Try another database user for the connection as it's unlikely you used "root" when you set up SilverStripe.

To do this, change "username" => "root" replacing "root" with the database user and of course the corresponding password replaces "root" in "password" => "root"