【发布时间】:2017-09-17 10:27:51
【问题描述】:
我的问题是当我开始监听端口时 xdebug 不起作用。我认为 PhpStorm 无法与 xdebug 链接。我只是得到调试器面板变量不可用。看起来 xdebug 的设置不正确。
使用的软件和版本:
Ubuntu 16.04 LTS
Docker v 17.06
docker-compose 1.15
所以我尝试了很多次设置 xdebug + Docker + PhpStorm 但无法做到。我已经阅读了很多教程,但没有什么对我有帮助。
我的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"
我的xdebug.ini 是:
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 设置:
【问题讨论】:
-
你先描述一下你的问题是什么
-
1) 为这种不成功的调试会话收集 xdebug 日志并分享它 -- xdebug.org/docs/all_settings#remote_log 2) 如果你在 Docker 中运行它,为什么要
xdebug.remote_host=localhost?它必须是运行 PhpStorm 的计算机的 IP。
标签: php ubuntu docker phpstorm xdebug