Skip to content

XDebug not working with PhpStorm #782

Open
@danut007ro

Description

@danut007ro

Hello,

I'm trying to use XDebug with PhpStorm on a fresh clone of this repo. I followed all the steps outlined in the documentation. Here are my relevant settings in PhpStorm:
Image

I added the following lines in 20-app.dev.ini:

xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.log=/tmp/xdebug.log
xdebug.log_level=10

I'm using XDEBUG_MODE=debug docker compose up --build command to start the project, but PhpStorm shows an error popup (screenshot below).

Cannot accept external Xdebug connection
Cannot evaluate expression '$_SERVER['SERVER_PORT']'

Image

The log in /tmp/xdebug.log shows that indeed XDebug is connecting to PhpStorm but it's another issue, here's part of the log:

root@530aecc4a80a:/app# cat /tmp/xdebug.log 
[281473732758880] Log opened at 2025-04-11 16:01:50.121074
[281473732758880] [Config] WARN: Not setting up control socket with default value due to unavailable 'tsc' clock
[281473732758880] [Step Debug] INFO: Connecting to configured address/port: host.docker.internal:9003.
[281473732758880] [Step Debug] INFO: Connected to debugging client: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port).
[281473732758880] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///app/bin/console" language="PHP" xdebug:language_version="8.3.19" protocol_version="1.0" appid="281473732758880"><engine version="3.4.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2025 by Derick Rethans]]></copyright></init>

[281473732758880] [Step Debug] <- feature_set -i 1 -n show_hidden -v 1
[281473732758880] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>
...

Did I miss something about the setup? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationDocumentation needs adjustment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions