我的问题是当我开始监听端口时 xdebug 不起作用。我认为 PhpStorm 无法与 xdebug 链接。我刚刚得到调试器面板变量不可用。看来 xdebug 没有正确设置。
使用的软件及版本:
Ubuntu 16.04 LTS
Docker v 17.06
docker-compose 1.15
所以我尝试了很多次设置 xdebug + Docker + PhpStorm 但无法做到。我读过很多教程,但没有什么对我有帮助。
My docker-compose.yml
看起来像这样:
version: '3'
services:
web:
image: nginx:latest
ports:
- "80:80"
restart: on-failure
volumes:
- "./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf"
- "./etc/ssl:/etc/ssl"
- "./project:/var/www/html/project"
depends_on:
- php
- db
php:
image: nanoninja/php-fpm
restart: on-failure
volumes:
- "./etc/php/php.ini:/usr/local/etc/php/conf.d/php.ini"
- "./project:/var/www/html/project"
db:
image: mysql
container_name: ${MYSQL_HOST}
restart: on-failure
env_file:
- ".env"
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
command: mysqld --sql-mode=NO_ENGINE_SUBSTITUTION
ports:
- "8988:3306"
volumes:
- "./data/db/mysql:/var/lib/mysql"
My xdebug.ini
is:
xdebug.default_enable=0
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_autostart=0
xdebug.remote_connect_back=0
xdebug.idekey="PHPSTORM"
xdebug.profiler_enable=0
xdebug.remote_host=localhost
PhpStorm 设置:
Linux 上的 Docker 允许 Xdebug 自动连接回主机系统,因此您只需设置xdebug.remote_connect_back=1
并省略xdebug.remote_host
在你的xdebug.ini
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)