diff --git a/src/Handler.php b/src/Handler.php
index dcdc10ce4f243c0e562a0aef39b7d1a2b1a80c6d..85ab0f415b254f80fbae8afa8c98dadf43ae0853 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -215,7 +215,6 @@ class Handler extends BaseHandler {
         $this->getDockerMountSource('/ssh-agent') :
         '$SSH_AUTH_SOCK';
     }
-    $this->config->setValue('php', $php, FALSE);
     $this->config->setValue('projectroot', $projectRoot, FALSE);
     $this->config->setValue('projectdomain', $this->config->readValue('projectname') . '.' . $traefik['domain'], FALSE);
     $this->config->setValue('projectprotocol', 'http' . ($traefik['usessl'] ? 's' : ''), FALSE);
@@ -233,8 +232,9 @@ class Handler extends BaseHandler {
     }
     $this->config->setValue('relatedprojectdomains', $relatedprojectdomains, FALSE);
     if (!empty($relatedprojectdomains)) {
-      $this->config->setValue('localip', TRUE, FALSE);
+      $php['localip'] = TRUE;
     }
+    $this->config->setValue('php', $php, FALSE);
 
     // Get ID of Docker group
     $docker_group_id = trim(shell_exec('stat -c "%g" /var/run/docker.sock'));
diff --git a/templates/docker-compose.yml.twig b/templates/docker-compose.yml.twig
index 757ea486f7789b3f9d5871d9201082bcc440107d..adb958c2821f1b328df8f20306e84e58e04c82b7 100644
--- a/templates/docker-compose.yml.twig
+++ b/templates/docker-compose.yml.twig
@@ -101,7 +101,7 @@ services:
 {% if wkhtmltox.enable %}
       - './.docker-init/wkhtmltox.sh:/docker-entrypoint-init.d/50-wkhtmltox.sh'
 {% endif %}
-{% if localip %}
+{% if php.localip %}
     extra_hosts:
       - '{{ projectdomain }}:{{ docker0.ip }}'
 {% for subdomain in relatedprojectdomains %}