我正在尝试远程运行 Lando 以避免消耗本地资源。有时我需要在笔记本电脑上工作,而lando+xdebug 是一只饥饿的野兽。
当地的
我没有在本地运行 Lando。我正在使用 PHPStorm 同步我的文件,而 Lando 正在远程运行。
偏僻的
我有一个 DigitalOcean 液滴设置并运行一个 Lando (drupal8) 站点。我可以访问该站点,并且它在以下位置正常运行:
165.xxx.xxx.xxx,作为水滴的 IP 和
ppppp,是Lando(docker)暴露容器的端口
.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
因为我不希望我的开发人员使用这个配置
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 服务器
- 主机:本地主机
- 端口:9002
- 调试器:Xdebug
- 使用路径映射(选中) --
project
-->/app
我运行这个的步骤
- 开始在 PHPStorm 中侦听调试连接
- 创建 SSH 隧道
ssh -R 9002:localhost:9002 root@165.xxx.xxx.xxx
- 刷新
http://165.xxx.xxx.xxx:ppppp
发现
- 使用
lando php -i
,我可以看到 xdebug 正在运行(并且我的所有 php.ini 配置都已设置),它应该在端口 9002 上运行。 - 使用
nc -z localhost 9002 || echo 'no tunnel open'
,我还可以知道 SSH 隧道已为 9002 打开,应该是这样。 - 我没有收到任何传入连接的提示
更新:
当我通过以下方式强制打开 9002 时取得了一些进展:
sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 9002 -j ACCEPT
但是,现在我收到此错误
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