Why is $base_url = http://{$_SERVER['SERVER_NAME']} in settings.php? Will this cause any problems? I saw this on a legacy website and I am not sure why our sys-admin insists on doing it this way. While most things are working fine, I wonder how will this affect the site, for example, I know the $_SERVER is not defined on cli and every time I execute a drush command it gives me parse_url(http:///example): Unable to parse URL in drupal_settings_initialize() (line 718 of                                                 [warning]
path/to/includes/bootstrap.inc).
If the site is served by a single application server and that name will never change, then this isn't wrong, but not the way I would do it.

If you want to use SERVER_NAME and avoid issues if it's not initialized:

$base_url = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';


Or, instead of empty quotes, specify the server name if it doesn't change.