Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Rebuild _config.php

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

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

Page: 1
Go to End
Author Topic: 2134 Views
  • BigChris
    Community Member
    63 Posts

    Rebuild _config.php Link to this post


    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 http://www.cleanco-ltd.co.uk/

    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.


  • BigChris
    Community Member
    63 Posts

    Re: Rebuild _config.php Link to this post

    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.


  • ThereBeDragonsHere
    Community Member
    8 Posts

    Re: Rebuild _config.php Link to this post

    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 http://www.silverstripe.org/themes/


    What needs to be fixed? Thanks.

  • TotalNet
    Community Member
    181 Posts

    Re: Rebuild _config.php Link to this post

    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 ;)


  • ThereBeDragonsHere
    Community Member
    8 Posts

    Re: Rebuild _config.php Link to this post

    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?

  • TotalNet
    Community Member
    181 Posts

    Re: Rebuild _config.php Link to this post

    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"

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.