我已经阅读了一些关于此的帖子,但在我的案例中没有任何帮助,或者只是忽略了丢失的部分.
我无法使用Docker容器让xdebug在PHPStorm上工作.
泊坞窗,compose.yml
version: '2'
services:
web:
image: Nginx:latest
volumes:
- .:/usr/share/Nginx/html
- ./Nginx/Nginx.conf:/etc/Nginx/Nginx.conf
- ./Nginx/logs:/var/logs/Nginx
- ./Nginx/site-enabled/default.conf:/etc/Nginx/sites-enabled/default.conf
ports:
- "80:80"
depends_on:
- PHP
db:
image: MysqL:5.7
environment:
MysqL_ROOT_PASSWORD: 1234
MysqL_DATABASE: local_db
MysqL_USER: root
MysqL_PASSWORD: 1234
ports:
- "3306:3306"
PHP:
build: images/PHP
volumes:
- .:/usr/share/Nginx/html
- ./config/docker/PHP/PHP.ini:/usr/local/etc/PHP/PHP.ini
- ./config/docker/PHP/ext-xdebug.ini:/usr/local/etc/PHP/conf.d/ext-xdebug.ini
- ./config/docker/PHP/PHP-fpm.conf:/usr/local/etc/PHP-fpm.conf
user: www-data
depends_on:
- db
配置/搬运工/ PHP / EXT-xdebug.ini
zend_extension="/usr/lib/PHP7/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.overload_var_dump=1
xdebug.default_enable=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back=1
xdebug.remote_host=172.20.0.1 # ip of host inside docker container
xdebug.remote_log=/usr/share/Nginx/html/xdebug.log
来自xdebug.log的错误
Log opened at 2017-05-31 11:01:14
I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Checking header 'REMOTE_ADDR'.
I: Remote address found, connecting to 172.20.0.1:9000.
W: Creating socket for '172.20.0.1:9000', poll success, but error: Operation Now in progress (29).
E: Could not connect to client. :-(
Log closed at 2017-05-31 11:01:14
在PHPStorm我正在使用具有以下设置的远程调试器:
服务器
Host - 127.0.0.1
Port - 80
服务器上的绝对路径
/usr/share/Nginx/html
IDE会话密钥
PHPSTORM
解决方法:
https://forums.docker.com/t/ip-address-for-xdebug/10460/9
我必须将我的内部ip设置为xdebug.remote_host并禁用xdebug.remote_connect_back = 0
似乎这是一个osx的事情.
希望这能帮到这里的人
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。