1

I've got the focuslab config set up and everything works fine on localhost. However my staging server it doesn't work. I've determined that it's likely due to using an ipaddress in the host for config.env.php

    case '111.222.333.444' :
        define('ENV', 'stage');
        define('ENV_FULL', 'Staging');
        define('ENV_DEBUG', FALSE);
    break;

    default :
        define('ENV', 'local');
        define('ENV_FULL', 'Local');
        define('ENV_DEBUG', TRUE);
    break;

If I take one of my domains and use it as a pointer domain on the same server and change the ip to the domain it works. Unfortunately I can't keep that domain pointed there as I did that just for testing.

So the non work is http://111.222.333.444/~username but if I point a domain to the same host it works.

Is there some way to get master config to work with an ip address instead of a domain?

2
  • I'm trying to get my Focus Lab config file to work with an IP address just as you did but I'm getting a white screen. Did you use the code provided by Derek Hogue to get this resolved? If so, did you replace everything in the config.env.php file with his code? Just trying to figure out what may be causing the issue. Thanks. Commented Mar 25, 2015 at 5:19
  • @BradHopkins I ended up just pointing a subdomain I own to the temporary url and using that.
    – CreateSean
    Commented Mar 25, 2015 at 17:37

1 Answer 1

3

That's because the config file is checking the value of $_SERVER['HTTP_HOST']. What you need to check is $_SERVER['SERVER_ADDR'].

try this:

if(!empty($_SERVER['HTTP_HOST']))
{
    switch (strtolower($_SERVER['HTTP_HOST'])) {
        // Standard case statements here
    }
}
else
{
    if($_SERVER['SERVER_ADDR'] == '111.222.333.444')
    {
        define('ENV', 'stage');
        define('ENV_FULL', 'Staging');
        define('ENV_DEBUG', FALSE);
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.