PHPStorm+Wordpress: Debug admin plugin, changes in latest update
Hi everyone,
I am trying to debug one of my wordpress plugins with PHPStorm and XDebug. Until a few weeks ago, this worked really well (so at one point, it was configured correctly), but now I am having the following issue:
1. I set a breakpoint in my plugin script
2. I run the website on my localhost
3. instead of halting at the breakpoint in my file “adm.php”, the “admin.php” from the wordpress installation is being opened in PHPStorm and halted at the first line
I suspect it halts at the first line because of Settings > PHP > Debug > Force Break at first line …
If I disable it, I get “Debug session was finished without being paused”.
Expected behaviour: PHPStorm halts at my breakpoints and does not open any additional files on its own that have no breakpoints.
system configuration:
- linux mint 21.2, kernel 6.2
- php 8.1, xdebug 3.1.2, phpinfo() validation passes, browser toolbar installed in chrome 119
- wordpress integration is enabled with the installation path set to the root of the wordpress folder
- apache localhost :80, xdebug on standard ports, no path mappings used
The problems coincided with PHPStorm's update with the new UI. Not sure if they are connected or if it's another component in the chain.
Please sign in to leave a comment.
Hi,
Could you please try a simple test?
Create a new .php file with an ordinary `echo` line, set a breakpoint on it and try to open this file from your web-server, would it break on this line or fail with the “Debug session was finished without being paused” too?
Hi, I have made the following test:
- new folder with 2 files: index.php and include.php
- index.php has some echo lines and then calls require() on include.php
- there is some other echo in include.php
No matter where I set the breakpoints, I always get haltet at line 1 of index.php.
I also get the “Debug session was finished without being paused” if I disable all the “force break at 1st line” options in the settings.
Hi,
It might be something wrong with mappings. Please try to remove everything from “PHP > Servers” and initiate a debug session again, would an “Incoming debug…” window appear?
Hi again, I removed my “localhost” entry from PHP > servers. The window “Incoming debug… ” does appear. Here is what it says:
Server name: localhost
Server port: 80
Request uri: /www/test/
File Path on server: /var/www/html/www/test/index.php (the second www is actually a symlink to my home folder)
Configure local file path: Manuall choose…. test > /home/broozar/www/test/index.php (which is the true path behind the symlink)
Notes:
- Only the “index.php” file is listed there, not the “include.php” which also belongs to the project.
- Even so, breakpoints in “index.php” also do not work as expected. Instead of halting at the breakpoint, I get sent to line 1.
- The symlink was never an issue before.
- I have no deployment setup, it was never required before.
Edit: I do get a message in the debuggertab now, it says:
The script '/var/www/html/www/test/index.php' is outside the project.
Click to set up path mappings
I suppose it is a symlink issue after all, however one I do not seem to be able to resolve. I tried setting the path to the project root, tried setting each php file separately, I did not have any success.
Hi,
I have reviewed your original message and I wonder why it was working before:
> The problems coincided with PHPStorm's update with the new UI.
I do not recall any recent changes in the debugging engine that may affect this behaviour. However, I have seen a couple of reports where debug has stopped to work and re-creating records or disabling “Ignore external connections…” has helped:
Would it be possible to show a screenshot from “PHP > Servers” or/and share the log files pack?
Logs can be collected with the “Help > Collect Logs” menu action. If you decide to share logs, before you collect these, please enable the extended log level for PHP subsystem and reproduce the connection again. To enable it, add the following line to the “Help > Diagnostic Tools > Debug Log Settings”:
#com.jetbrains.php
Also, in addition, Xdebug logs may help. You may want to enable Xdebug logging first:
https://xdebug.org/docs/all_settings#log
Hi, thank you - that actually helped. I switched off “enable external connections” and set the path in Servers again. Now it works as I came to expect it from earlier versions. Here is the screenshot you requested:
I gathered the logs you wanted, but since it already works, I don't think they would be worth your time, so I didn't upload them.
Thanks again for your help.