I'm unable to get my website up and running

Silverstripe Version: 3.6

I’ve just tried to load my website for the first time after downloading the Silverstripe package. When I do this I get the following error message: SilverStripe Framework requires a $databaseConfig defined. Does anyone know a solution to this issue? I’m running it on localhost using XAMPP version 5.6.40

Hi,

Have you followed the instructions in the docs here: https://docs.silverstripe.org/en/3/getting_started/environment_management/

It’s worth mentioning, if this is a new website, it’s really worth starting on SS4 instead of SS3. - SS3 is in support-only now whereas SS4 is in active development.

As another aside, it’s worth running on PHP7 rather than PHP5. PHP5 is end of life, and PHP7 is generally a lot quicker to run. Even the latest SS3 versions support PHP7.2

Thanks for your comment. I should have been more specific in my question but I’m using a repository created by someone else… i.e. it’s a template for us to easily add features to the website i.e. text, image blocks etc. I know the project was only created last year. I was just thinking if anyone was aware of the error I’m experiencing… maybe it’s an easy fix? I know the repository developer hadn’t changed the database config files so it’s a bit strange that this error is coming up :confused:

Well, hopefully the database configuration isn’t stored in the repository :wink:

The error message is pretty much what it says: the framework can’t find a database configuration. Have you checked the _config.php and _ss_environment.php files to see what’s in them?

Yes, the ConfigureFromEnv.php holds the database connection details and is called within the _config.php file. I can’t see any sign of a _ss_environment.php file though!?

Hmmm… the database details shouldn’t really be in ConfigureFromEnv.php - that’s the file which sets it all up, and reads the configuration… If you have details in that file, they’re going to get overwritten whenever the framework is updated.

The normal set up would be to have a _ss_environment.php file which contains the config data. In your _config.php file, you’d then have something like this:

<?php

global $project;
$project = 'mysite';

global $database;
$database = '(databasename)';

// Use _ss_environment.php file for configuration
require_once("conf/ConfigureFromEnv.php");

The error message is being thrown in main.php because it can’t find a valid $databaseConfig - this is set up in ConfigureFromEnv.php around line 90 assuming everything has been set up properly.

Ahh that’s interesting… thank you for that. Could you tell me where the _ss_environment.php file would be? I can’t see any sign of it! :frowning:

My _config.php looks exactly like you showed though! The ConfigureFromEnv.php is being called through the require_once function…

You might have to create one. As I said, it’s hopefully not part of the repository you downloaded (since storing db connection information like that isn’t a good thing to do). You can just create it in web root for simplicity using the syntax on the page I linked earlier.