Xdebug not working with PHP-FPM and nginx
I have a fully working Xdebug in step debugger mode with Apache on Linux.
However, I need to get PhpStorm working with nginx.
My nginx server is fully working with PHP.
The step debugger is confirmed as working with xdebug_info(), i.e. the “Step Debugger” is enabled.
I have listening for “PHP Debug Connections” enabled in PhpStorm.
These are the Xdebug logs on the server when I load a page with PhpStorm listening for debug connections:
[940] Log opened at 2024-01-31 11:45:03.242008
[940] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[940] [Config] INFO: No shared secret: Activating
[940] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_FORWARDED_FOR,REMOTE_ADDR'.
[940] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[940] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[940] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 192.168.1.87:9003.
[940] [Step Debug] INFO: Connected to debugging client: 192.168.1.87:9003 (from REMOTE_ADDR HTTP header).
[940] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///shared/Test/index.php" language="PHP" xdebug:language_version="8.2.7" protocol_version="1.0" appid="940" idekey="PHPSTORM"><engine version="3.2.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2022 by Derick Rethans]]></copyright></init>
...
[940] [Step Debug] <- detach -i 16
[940] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="16" status="stopping" reason="ok"></response>
[940] Log closed at 2024-01-31 11:45:03.613424
Thing is, it's almost the same log as an Apache setup.
However, step debugging is not working in PhpStorm.
Does anyone have Xdebug working with an nginx setup?
Please sign in to leave a comment.
OK, so I managed to fix this:
Settings → PHP → Debug
Switch off:
Ignore external connections through unregistered server configurations
I can then add the server configuration.
It now works.