XDebug & PHPStorm Stopping at First Line

I have XDebug setup with PHPStorm and it breaks at the first line of my project, however ‘Step Over’ does not do anything, and setting breakpoints anywhere else in the project fails.

I am using a remote debugging setup, my XDebug config is as follows

zend_extension="xdebug.so"
xdebug.mode=debug
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.log=/tmp/xdebug.log
xdebug.log_level=10
xdebug.idekey=PHPSTORM

 

I then connect to the remote machine using an SSH tunnel. The connection to PHPStorm is made and it breaks at the first line.

 

 

If I then hit ‘Step Over’ to move to the next line, the debug session ends. I also have breakpoints set in my project that should be hit, but are not. The path mappings are set correctly.

 

 

I can also map the individual file in the nested tree that opens, it doesn't change the fact that the breakpoint never gets hit. If I delete the server, when I make the request I am asked to setup the path mappings again - I can do this but nothing changes. 

 

I have checked that the files do indeed match by using SCP to grab them and diffing, I have made sure the composer lock is the same, the composer version is the same (In an attempt to ensure it wasn't being caused by a vendor mismatch).

 

I am using PhpStorm 2023.3.4 and Xdebug 3.3.1. I have made sure also that opcache is disabled.

 

 

At this point I have tried everything I can think of, even setting the XDebug logs to level 10, which doesn't reveal any errors. 

0
19 comments

In my experience when only the first line is hit by the debugger, not your other breakpoints, your path mapping is incorrect and it fallsback to a break on the first line. This behavior is a setting in your PHP settings: “Force break at first line when no path mapping specified”. 

0

The reason it is breaking at the first line is because I have it set to, if I remove it no breakpoint is hit at all. 

I understand it is normally a path mapping issue, however I can't see how.

 

The first is my settings, the second is the remote and local server showing the same path for a file. I have even set it for that file specifically and nothing. 

0

Hi there,

Try enabling extra logging from the IDE side – it should show how it matches the paths etc.

https://www.jetbrains.com/help/phpstorm/troubleshooting-php-debugging.html#collect-debugging-logs

0

Hey, 

I have tried enabling more verbose debugging but it didn't help me, I will share the logs in case someone else can see something I can't.

With ‘Break at First Line' Disabled.


[1385016] Log opened at 2024-04-05 10:51:51.124677
[1385016] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.1385016'
[1385016] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[1385016] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[1385016] [Config] INFO: No shared secret: Activating
[1385016] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[1385016] [Step Debug] INFO: Connected to debugging client: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[1385016] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/private/public/index.php" language="PHP" xdebug:language_version="8.2.17" protocol_version="1.0" appid="1385016" idekey="PHPSTORM"><engine version="3.3.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2023 by Derick Rethans]]></copyright></init>
[1385016] [Step Debug] <- feature_set -i 1 -n show_hidden -v 1
[1385016] [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>
[1385016] [Step Debug] <- feature_set -i 2 -n max_depth -v 1
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>
[1385016] [Step Debug] <- feature_set -i 3 -n max_children -v 100
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>
[1385016] [Step Debug] <- feature_set -i 4 -n extended_properties -v 1
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response>
[1385016] [Step Debug] <- feature_set -i 5 -n notify_ok -v 1
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>
[1385016] [Step Debug] <- feature_set -i 6 -n breakpoint_include_return_value -v 1
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="breakpoint_include_return_value" success="1"></response>
[1385016] [Step Debug] <- stdout -i 7 -c 1
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="7" success="1"></response>
[1385016] [Step Debug] <- status -i 8
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="8" status="starting" reason="ok"></response>
[1385016] [Step Debug] <- step_into -i 9
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="9" status="break" reason="ok"><xdebug:message filename="file:///var/www/private/public/index.php" lineno="10"></xdebug:message><xdebug:return_value><property type="float"><![CDATA[1712314312.286]]></property></xdebug:return_value></response>
[1385016] [Step Debug] <- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="10"><property type="bool"><![CDATA[0]]></property></response>
[1385016] [Step Debug] <- eval -i 11 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="bool"><![CDATA[1]]></property></response>
[1385016] [Step Debug] <- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="string" size="28" encoding="base64"><![CDATA[YWRtaW4uYmV0YS5ldHRlcm5hb25saW5lLmNvbQ==]]></property></response>
[1385016] [Step Debug] <- eval -i 13 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="string" size="3" encoding="base64"><![CDATA[NDQz]]></property></response>
[1385016] [Step Debug] <- eval -i 14 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="14"><property type="string" size="9" encoding="base64"><![CDATA[L25vdGVza2lu]]></property></response>
[1385016] [Step Debug] <- breakpoint_set -i 15 -t line -f file:///var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php -n 36
[1385016] [Step Debug] DEBUG: Setting 'has_line_breakpoints on microtime (/var/www/private/public/index.php:10)
[1385016] [Step Debug] DEBUG: Setting 'has_line_breakpoints on {main} (/var/www/private/public/index.php:0)
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="15" id="742960003"></response>
[1385016] [Step Debug] <- stack_get -i 16
[1385016] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="16"><stack where="microtime" level="0" type="file" filename="file:///var/www/private/public/index.php" lineno="10"></stack><stack where="{main}" level="1" type="file" filename="file:///var/www/private/public/index.php" lineno="10"></stack></response>
[1385016] [Step Debug] <- run -i 17
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/autoload.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/composer/autoload_real.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/composer/platform_check.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/composer/ClassLoader.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/composer/autoload_static.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-mbstring/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-mbstring/bootstrap80.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/deprecation-contracts/function.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-intl-normalizer/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-intl-normalizer/bootstrap80.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-php80/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-ctype/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-ctype/bootstrap80.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-php72/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-intl-idn/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-intl-grapheme/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/string/Resources/functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/var-dumper/Resources/functions/dump.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-php83/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-php83/bootstrap81.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/ralouphie/getallheaders/src/getallheaders.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/translation/Resources/functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/nunomaduro/termwind/src/Functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/guzzlehttp/guzzle/src/functions_include.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/guzzlehttp/guzzle/src/functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/ramsey/uuid/src/functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-uuid/bootstrap.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/symfony/polyfill-uuid/bootstrap80.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/laravel/prompts/src/helpers.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/laravel/framework/src/Illuminate/Collections/helpers.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/laravel/framework/src/Illuminate/Events/functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/laravel/framework/src/Illuminate/Filesystem/functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/fakerphp/faker/src/Faker/Factory.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/laravel/framework/src/Illuminate/Support/helpers.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/clue/stream-filter/src/functions_include.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).
[1385016] [Step Debug] DEBUG: Breakpoint 742960003 (type: line).
[1385016] [Step Debug] DEBUG: R: File name (/var/www/private/vendor/clue/stream-filter/src/functions.php) does not match breakpoint to resolve (/var/www/private/app/Http/Controllers/Admin/NoteskinCrudController.php).

 

This goes on for quite a while, it seems like it's checking it against every file… so it should eventually find the correct file? 

 

Toward the end of the log file I also get this message thousands of times.


[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950004 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950004 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950004 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950004 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950004 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950004 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950004 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950004 (type: line) is already resolved.

 

Actually it appears there are 100,000+ of that message, but the log file ends like this.


[1385015] [Step Debug] DEBUG: Breakpoint 742950005 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950005 (type: line) is already resolved. 
[1385015] [Step Debug] DEBUG: Breakpoint 742950005 (type: line). 
[1385015] [Step Debug] DEBUG: D: Breakpoint 742950005 (type: line) is already resolved. 
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="18" status="stopping" reason="ok"></response> 

[1385015] [Step Debug] <- detach -i 19 
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="19" status="stopping" reason="ok"></response> 

[1385015] Log closed at 2024-04-05 11:02:39.012826

0

Also according to the Xdebug docs

 

The fileuri attribute lists the entry point of your application, which can be useful to compare to breakpoint_set commands to see if path mappings are set-up correctly.

 

And it appears to me that it is set correctly, so that should rule out path mapping issues?

0

Theropfather 

And it appears to me that it is set correctly, so that should rule out path mapping issues?

Not always / not directly.

I mean: normally I do not have any issues with setting the web page debug. But recently (a few weeks ago) I was working on a Laravel project, doing the artisan commands  (parsing data, storing it in the DB etc) and CLI debug works fine as usual. But when I have started to work on the web interface .. I had issues with setting it up – it could not stop on breakpoints, at all. At the same time – it still worked fine in another project (all local, PHP 8.2, Xdebug 3.3.1, Windows 10 & IIS web server).

I'm not sure what did it, but the next IDE session the same thing (my latest IDE settings changes) worked from first attempt. Not sure if a PC restart helped or PhpStorm one (as I do not remember now if it was on the same day or on the next one – I'm shutting down my PC every night).

So …

  1. Try restarting the IDE and PC if you have not tried it yet
  2. Please post your IDE settings:
    • Settings/Preferences | PHP | Servers” (can blur/redact private info, but keep as much as possible) – unlikely to be the reason here though.
    • WHOLE thing on “Settings/Preferences | PHP | Debug” (including those collapsed at the very bottom)

It's possible that one of the settings (from the last point) do interfere. And that's why the logs from the IDE side of things might help (in case they are “looking for the wrong stuff”)

0

Here are the screenshots requested, I had already posted the PHP Servers info above, but this time I've included some more of the path mappings.

 

 

And here are the debug settings.

 

As noted in above posts, setting Break at first line does in fact break at the first line, but nothing else works after that, even stepping to the next line in index.php, which is where the breakpoint is anyway?

 

I've also tried disabling Resolve breakpoint if it's not available, force break at first line when no path mapping, force break at first line when a script is outside and enable return function value debugging. 

 

 

0

Thanks.

1. Do you have any deployment entries configured for this project? If yes – do you have one that is marked as default?

2. Regardless of the above – try disabling this option: “Settings/Preferences | PHP | Debug | Detect path mappings from deployment configurations”. Any difference?

If not – try deleting the “PHP | Server” entry, maybe even restart the IDE at this point, and then try to debug (so that IDE will create a new entry). This is in case if it still has any “links” to the old info…

 

If still the same – then you would need to look into the logs (no better ideas from me ATM). If you do not want to share them here – then you will have contact PhpStorm Support by creating a Support Ticket via that big blue “Submit a Request” button at the top where you can privately provide all the info and JetBrains staff will look into that when they have time (will be busy now, shortly after a release).

0

As noted in above posts, setting Break at first line does in fact break at the first line, but nothing else works after that, even stepping to the next line in index.php, which is where the breakpoint is anyway?

Xdebug log – what command the IDE issued. Where breakpoint was set (what file and line). Was it confirmed by Xdebug? etc.

If it was set correctly – does Xdebug tries to stop there? Because if it does not try then it's either does not see it (breakpoint was not set) or an issue in actual Xdebug…

 

P.S. What's your PHP and Xdebug versions? If it's latest Xdebug v3.3.1 and PHP is 8.2 or older – try how Xdebug 3.2.x will do.

0

I do have deployment entries set, and yes one is marked as default. 

 

With Detect path mappings from deployment configurations disabled, nothing changes.

 

I removed the servers, which I have done before in an attempt to fix and restarted and was presented with the expected window.

 

 

Accepting this path mapping, of course does not change anything. 

 

Interestingly though, when I looked at the deployment import it shows.

 

 

No suitable deployment configurations was found. I'm unsure why that is, because the deployment path mappings are correct

 

 

Regardless, manually or deployment, same result. No breakpoints hit, first line can be hit but nothing else, not even stepping after that.

 

I will take a look at the IDE logs, since the Xdebug logs are above for anyone to look at. If I don't see anything I'll try to anonymize the logs and post them. 

0

Here are the IDE logs that are relevant.

 

2024-04-05 14:08:36,174 [  16946]   FINE - #c.j.p.u.c.ServerConnection - Incoming connection on port 9003 from 0:0:0:0:0:0:0:1
2024-04-05 14:08:36,193 [  16965]   FINE - #c.j.p.l.p.r.t.PhpParameterBasedTypeProvider - DONE COMPUTING MethodTypesMap => 240
2024-04-05 14:08:36,195 [  16967]   WARN - #c.j.p.PhpIndex - Completing type '#π(#F\microtime)(#D\true)' took 775ms, visited:[#π(#F\microtime)(#D\true)]
2024-04-05 14:08:36,230 [  17002]   FINE - #c.j.p.d.c.PhpDebugConnection - 582582487#----connection started
2024-04-05 14:08:37,235 [  18007]   INFO - #c.i.j.n.n.r.NpmRegistryServiceImpl - Found 37 dist-tags, 198 versions for @types/lodash in 343ms
2024-04-05 14:08:37,322 [  18094]   FINE - #c.j.p.r.f.PhpFilter - Path mapper: com.jetbrains.php.util.pathmapper.PhpRemotePathMapper@32459c8e
2024-04-05 14:08:37,322 [  18094]   FINE - #c.j.p.r.f.PhpUnitFilter - Path mapper: com.jetbrains.php.util.pathmapper.PhpRemotePathMapper@32459c8e
2024-04-05 14:08:37,322 [  18094]   FINE - #c.j.p.r.f.PhpFilter - Path mapper: com.jetbrains.php.util.pathmapper.PhpRemotePathMapper@32459c8e
2024-04-05 14:08:37,375 [  18147]   FINE - #c.j.p.d.c.PhpDebugProcess - 1406871091# Stop at ('file:///var/www/private/public/index.php':9)
2024-04-05 14:08:37,375 [  18147]   FINE - #c.j.p.d.c.PhpDebugProcess - 1406871091# remote: 'file:///var/www/private/public/index.php' <-> local: '//var/www/private/public/index.php'
2024-04-05 14:08:37,375 [  18147]   FINE - #c.j.p.d.c.PhpDebugProcess - 1406871091# remote: 'file:///var/www/private/public/index.php' <-> extracted: '/var/www/private/public/index.php'
2024-04-05 14:08:37,715 [  18487]   FINE - #c.j.p.r.f.PhpFilter - Path mapper: com.jetbrains.php.util.pathmapper.PhpIdenticalPathMapper@7eaeda5c
2024-04-05 14:08:37,715 [  18487]   FINE - #c.j.p.r.f.PhpFilter - Path mapper: com.jetbrains.php.util.pathmapper.PhpIdenticalPathMapper@57663ac
2024-04-05 14:08:37,716 [  18488]   FINE - #c.j.p.r.f.PhpFilter - Path mapper: com.jetbrains.php.util.pathmapper.PhpIdenticalPathMapper@37d01efc
2024-04-05 14:08:37,716 [  18488]   FINE - #c.j.p.r.f.PhpFilter - Path mapper: com.jetbrains.php.util.pathmapper.PhpIdenticalPathMapper@4ef410f1
2024-04-05 14:08:39,167 [  19939]   FINE - #c.j.p.d.c.PhpDebugConnection - 582582487#---stop reading
2024-04-05 14:08:39,167 [  19939]   FINE - #c.j.p.d.c.PhpDebugConnection - 582582487#---stop writing
2024-04-05 14:08:39,167 [  19939]   FINE - #c.j.p.d.c.PhpDebugConnection - 582582487#----connection stopped
2024-04-05 14:08:39,168 [  19940]   FINE - #c.j.p.u.c.ServerConnection - ----socket closed

 

I don't know what to make of this, it seems to me, the mapping is correct, everything should work but I assume when I click ‘Step Over’ or ‘Resume’ it results in ‘Stop reading’, ‘Stop writing’, ‘Connection stopped’ and then socket closed. 

 

I am in the process of installing 2024.1, in a hope that it may randomly fix this issue.

0
xdebug.log_level=10

1. Please remove/comment out this line and try to collect Xdebug log again. It is indeed has way too much not needed details (for me at least). Default level (which is “7” IIRC) is enough.

2. Please create a separate file (e.g. xdebug-index.php and place it in your public folder). Then place a simple code similar to this one:

<?php
$a = 1;
$b = 3;
$c = $a + $b;
echo $c;

and place breakpoint on the $b = 3; line. Simple code (one simple instruction per line) + break on the 2nd executed line of code.

Now try to debug this file directly (site.com/xdebug-index.php)

Collect the logs for this one actually.

3. OPCache… can you either disable loading it completely (so it's not listed in PHP info at all) or ensure that it is loaded before xdebug one (should be by default anyway IIRC… but hey)

4. Remove any other breakpoints (use Bookmarks toolwindow – it lists all stuff) and watches (to avoid irrelevant for us evals)

 

P.S. IDE side log seems OK to me.

Do the Xdebug log (it should be quite short if all above is done) and post it here.

0

I've lowered the logging level to default.

I did as you asked and created the xdebug.php file in both locations (local and server) and set a breakpoint on line #2. Here is the Xdebug log for that exchange. 

 

[1385015] Log opened at 2024-04-05 14:40:48.272257
[1385015] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.1385015'
[1385015] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[1385015] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[1385015] [Config] INFO: No shared secret: Activating
[1385015] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[1385015] [Step Debug] INFO: Connected to debugging client: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[1385015] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/private/public/xdebug.php" language="PHP" xdebug:language_version="8.2.17" protocol_version="1.0" appid="1385015" idekey="PHPSTORM"><engine version="3.3.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2023 by Derick Rethans]]></copyright></init>
[1385015] [Step Debug] <- feature_set -i 1 -n show_hidden -v 1
[1385015] [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>
[1385015] [Step Debug] <- feature_set -i 2 -n max_depth -v 1
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>
[1385015] [Step Debug] <- feature_set -i 3 -n max_children -v 100
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>
[1385015] [Step Debug] <- feature_set -i 4 -n extended_properties -v 1
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response>
[1385015] [Step Debug] <- feature_set -i 5 -n notify_ok -v 1
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>
[1385015] [Step Debug] <- feature_set -i 6 -n resolved_breakpoints -v 1
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="resolved_breakpoints" success="1"></response>
[1385015] [Step Debug] <- feature_set -i 7 -n breakpoint_include_return_value -v 1
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="7" feature="breakpoint_include_return_value" success="1"></response>
[1385015] [Step Debug] <- stdout -i 8 -c 1
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="8" success="1"></response>
[1385015] [Step Debug] <- status -i 9
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="9" status="starting" reason="ok"></response>
[1385015] [Step Debug] <- step_into -i 10
[1385015] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[Q29udGVudC10eXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9VVRGLTg=]]></stream>
[1385015] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[DQo=]]></stream>
[1385015] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[DQo=]]></stream>
[1385015] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[NA==]]></stream>
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="10" status="stopping" reason="ok"></response>
[1385015] [Step Debug] <- eval -i 11 -- Z2V0ZW52KCdQSFBfSURFX0NPTkZJRycpIT1mYWxzZQ==
[1385015] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><error code="5"><message><![CDATA[command is not available]]></message></error></response>
[1385015] Log closed at 2024-04-05 14:40:49.558698

 

 

Command is not available seems promising, however that is for eval not step_into (which I never clicked btw).

0

Also, I tried fully removing opcache instead of just disabling it, and I get a 502. 

It gives a coredump error, and I checked and dmesg shows

php-fpm8.2[1390664]: segfault at 10 ip 00007fc0a6343e38 sp 00007fffe505d7b0 error 4 in xdebug.so[7fc0a6328000+34000]

 

This appears when I comment out zend_extension=opcache.so entirely. 

0

Just the make the above clear

When I change 10-opcache.ini to look like this

; configuration for php opcache module 
; priority=10 
; zend_extension=opcache.so 
; opcache.jit=off 
; opcache.enable=0 

PHP-FPM segfaults, and the segfault is in xdebug.so

When set to this 

; configuration for php opcache module 
; priority=10 
zend_extension=opcache.so 
; opcache.jit=off 
; opcache.enable=0 

There is no segfault, no 502 and the website works as expected (sans the debugging)

**EDIT**

This is no longer the case?? I uninstalled and reinstalled opcache, and now I don't get the segfault either way - debugging is still busted though :)

0

It's solved, I fixed it, I'm both overjoyed and annoyed.

After running /usr/sbin/php-fpm -v it showed Xdebug must be loaded as a zend_extension.

The issue is so simple, but so easy to hide. I had set in my php.ini extension=xdebug alongside the 20-xdebug.ini after removing the faulty line extension=xdebug it all works, perfectly.

Thanks so much to everyone for the help, especially Andriy!!

1

Theropfather 

That was unexpected… 

If you have a bit of time, can you do the following:

  • Revert back that extension=xdebug change
  • See what xdebug_info(); function will print

TBH I was expecting Xdebug to detect such scenario… (cannot say if it's possible though, since I'm not into PHP source/internals)

0

Sure thing!

 

Doing what you asked, xdebug_info(); displays the following.

 

 

There is nothing of interest hiding below where the screenshot cuts off, just standard PHP build info, so I didn't take a second one. 

Yeah, it's strange that there is no mechanism for it to detect that it's running extension instead of zend_extension. I mean technically it is there, if you manually run PHP-FPM, but not many users do that or even know you can - strange one to handle. 

1

I've lowered the logging level to default.

I did as you asked and created the xdebug.php file in both locations (local and server) and set a breakpoint on line #2. Here is the Xdebug log for that exchange. 

Command is not available seems promising, however that is for eval not step_into (which I never clicked btw).

This comment just appeared (was on moderation all this time I guess…)

Not important any more (the issue is found and resolved) but anyway: the script execution was already complete when that eval command was sent (unless it's a “write to log” race condition of some kind)… No breakpoints attempted in that log.

0

Please sign in to leave a comment.