diff --git a/ahoy.debug.yml b/ahoy.debug.yml
new file mode 100644
index 0000000000000000000000000000000000000000..24bd08f439558ad6da5ada7965e23dce1490d7c9
--- /dev/null
+++ b/ahoy.debug.yml
@@ -0,0 +1,16 @@
+ahoyapi: v2
+commands:
+  on:
+    cmd: |
+      echo "PHP_DEBUG=1" >>.env
+      env -i $(cat .env | xargs) >.env
+      composer lakedrops:docker4drupal --no-interaction
+      ahoy d4d up
+    usage: Turn on PHP debugging
+  off:
+    cmd: |
+      echo "PHP_DEBUG=0" >>.env
+      env -i $(cat .env | xargs) >.env
+      composer lakedrops:docker4drupal --no-interaction
+      ahoy d4d up
+    usage: Turn off PHP debugging
diff --git a/composer.json b/composer.json
index a60ac4a823853fec2006491873f00148d547c8c2..d1c9d2080a1bf5e92f82f4a8b074cc17a510c212 100644
--- a/composer.json
+++ b/composer.json
@@ -54,6 +54,10 @@
                 "live": {
                     "usage": "Interact with the live site",
                     "imports": ["ahoy.live.yml"]
+                },
+                "debug": {
+                    "usage": "PHP debugging",
+                    "imports": ["ahoy.debug.yml"]
                 }
             }
         }
diff --git a/src/Handler.php b/src/Handler.php
index c4171ce0499ce02bac7a30b88afd072c6bb58a4c..67a486fa319f0dc2c39619f1af945b821dc306e3 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -261,7 +261,7 @@ class Handler extends BaseHandler {
         ],
         'php' => [
           'version' => $env->receiveGlobal('PHP_VERSION', 'PHP version', '7.2'),
-          'xdebug' => $this->isLocalDevMode() ? 1 : 0,
+          'xdebug' => $env->receiveGlobal('PHP_DEBUG', 'PHP debug', '0'),
         ],
         'webserver' => [
           'type' => 'apache',