1

I'm trying to run Lando remotely to avoid consuming local resources. Sometimes I need to work on a laptop and lando+xdebug is a hungry beast.

Local

I don't have Lando running locally. I'm synchronizing my files using PHPStorm and Lando is running remotely.

Remote

I have a DigitalOcean droplet set up and running a Lando (drupal8) site. I can access the site and it's running as normal at:

http://165.xxx.xxx.xxx:ppppp

165.xxx.xxx.xxx, being the IP of the droplet and

ppppp, being the port that Lando (docker) exposes the container

.lando.yml

name: XXXXXX
recipe: drupal8
config:
  php: 7.1
  webroot: ./docroot
  xdebug: false // overridden later
services:
  appserver:
    build:
      - composer install
  ruby:
    type: ruby:2.4
    run:
      - "cd $LANDO_MOUNT && gem install compass"
tooling:
  blt:
    service: appserver
    cmd: /app/vendor/acquia/blt/bin/blt
  gem:
    service: ruby
  compass:
    service: ruby
  fix-compass:
    service: ruby
    cmd: "gem install compass"

.lando.local.yml

Since I don't want this config for my fellow developers

config:
  xdebug: true
  config:
    php: .lando.php.ini

.lando.php.ini

xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_host = localhost
xdebug.remote_port = 9002
xdebug.remote_log = /xdebug.log
xdebug.remote_mode = req
xdebug.idekey = PHPSTORM

PHPStorm Server

  • Host: localhost
  • Port: 9002
  • Debugger: Xdebug
  • Use path mappings (checked) -- project --> /app

Steps I take to run this

  1. Start listening for debug connections in PHPStorm
  2. Create SSH tunnel with ssh -R 9002:localhost:9002 root@165.xxx.xxx.xxx
  3. Refresh http://165.xxx.xxx.xxx:ppppp

Findings

  • Using lando php -i, I can see that xdebug is running (and all of my php.ini config is set) as it should, on port 9002.
  • Using nc -z localhost 9002 || echo 'no tunnel open', I can also tell that SSH tunnel is open for 9002, as it should be.
  • I don't get any prompt for incoming connections

Update:

Some progress when I forced 9002 open with:

sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 9002 -j ACCEPT

However, now I get this error

Log opened at 2019-08-20 02:54:17
I: Connecting to configured address/port: 165.xxx.xxx.xxx:9002.
W: Creating socket for '165.xxx.xxx.xxx:9002', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2019-08-20 02:54:17
drupalphil
  • 91
  • 9

1 Answers1

2

So I've been experiencing this a few times this year. I originally solved this a few weeks ago by upgrading PHPSTORM from 2018.1 to 2019.1. It was indicated to me (on some thread on the internet) that the XML schema for the next version of xdebug was different. It worked immediately after updating. It seems though that this broke again in 2019.2.

The last time I got this to work was 2019.1.3. Best of luck!

Update: As I've continued to update both storm and php/xdebug, I've found that this has stabilized. It was all over the place for a while.

Ryan Hartman
  • 196
  • 1
  • 8