3

In my _ss_environment.php I have: define('SS_ENVIRONMENT_TYPE', 'dev'); and in my _config.php: require_once("conf/ConfigureFromEnv.php"); but for some reason my environment is still in live mode and cannot change to dev. I tested with simple function below:

 function display(){
  if (Director::isDev()){
    echo 'yes dev'; 
  } else {
    echo 'no not dev';
  }

}

display();

I need the dev environment because I'm loading extra css if its in dev. It might be something silly that I'm missing but could not figure it out, thanks in advance guys.

bummzack
  • 5,805
  • 1
  • 26
  • 45
user9117670
  • 151
  • 1
  • 6
  • Is your file really named `_ss_enviroment.php` or is that a typo? Because it should be enviro**n**ment – bummzack Dec 28 '17 at 13:23
  • sorry typo here – user9117670 Dec 28 '17 at 13:29
  • Where do you run that `display` function? – bummzack Dec 28 '17 at 13:56
  • in page.php class file, so eventually i decided just to declare dev enviroment in config php file like this `Director::set_environment_type('dev');` and this works for now. – user9117670 Dec 28 '17 at 20:52
  • If you're using SilverStripe 4, you will have an `.env` file which will sit in the root. `SS_ENVIRONMENT_TYPE` is the variable to change to `SS_ENVIRONMENT_TYPE="dev"` Reference: https://docs.silverstripe.org/en/4/getting_started/environment_management/ – Gavin Bruce Dec 29 '17 at 02:24
  • got you but using silverstripe 3 – user9117670 Dec 29 '17 at 14:52
  • Are you actually 100% sure that file is read, eg its not reading some other environment file? if you add a die() or use xdebug or something to confirm the right environment file is loaded. E.g do you actually have the database configuration also in that file? – Olli Tyynelä Jan 03 '18 at 10:01

0 Answers0