I am facing a strange problem when I am debugging PhpStorm, I am using XAMPP + PhpStorm + Xdebug.
I write code below and set up 4 breakpoint
<?php
$a=1;
$b=2;
$c=$a+$b;
echo $c;
After I click listener button and debug button,Chrome visit http://localhost/index.php, the first break point is reached.
Then strange phenomenon is here:
I can not watch variables value of $a, $b and $c, no matter in debug window or I put mouse over these variables.
I click F8, the left 3 breakpoints will not reach. I have no idea where is the program's step now, but I know response is not return to Chrome because Chrome is still loading.
Even stranger, if I remove all breakpoints and not click listener button and not click debug button, Chrome load success, but once I click listener button and debug button, refresh Chrome, Chrome will load forever unless I stop listen and stop debug then Chrome will load success. That is wired; I have already uncheck 'break at first line', there is no breakpoints at all. I guess PhpStorm stuck somewhere, but I do not know where it is.
Can someone help me please,the other computer can debug success but this computer never debug success.
1) Show whole Xdebug log (share the file)
Xdebug log is here:https://www.dropbox.com/s/psfktprtl2jfftq/debug2.log?dl=0
And here is a yeserday ealier bigger log:https://www.dropbox.com/s/64jnwhscatjaihq/debug2-ealier.log?dl=0
2) PHP & Xdebug versions?
PHP and Xdebug version in picture below.
xdebug log
Xdebug 2.7 requires PhpStorm 2018.3.x or newer.
Either upgrade PhpStorm to latest stable 2018.3.x or downgrade Xdebug to 2.6.x. That will resolve the issue.
Related
I am using PhpStorm on Ubuntu which I'm running on a Hyper-V machine. I'm trying to configure the PhpStorm debugger with XDebug. I've set a breakpoint in my code, but when I click "Start Listening for PHP Debug Connections" in PhpStorm and refresh my page, the debugger never enters my code. The debugger must be doing something because the page in the browser stays loading, until I click Stop in PhpStorm. If I don't click for the debugger to listen for connections, the page loads correctly.
The Debug window shows the error Remote file path '/var/www/magento2/pub/index.php' is not mapped to any file path in project, but I don't know how to get that to map correctly. In the path mappings windows, under "Include path", it shows a bunch of paths, but the path /var/www/magento2/pub isn't there. I can't find anywhere to add an additional path. Could this be a permissions issue for that folder? What permissions do I need to allow PhpStorm to map that path?
If I uncheck "use path mapping" in Preferences > Language & Framework > PHP > Servers and leave "Break at first line in PHP scripts" checked, then the debugger breaks on the first line of code, but I don't want to break until my breakpoint is hit.
If I uncheck "use path mapping" and don't check "Break at first line in PHP scripts", then I get the error Debug session was finished without being paused. It may be caused by path mappings misconfiguration or not synchronized local and remote projects. To figure out the problem check path mappings configuration for 'mydomain.local' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
Here's my XDebug configuration
zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.var_display_max_depth=-1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.idekey="PHPSTORM"
Update:
Here are the responses to #LazyOne's questions
1) The path to the project root is /var/www/magento2
2)
One thing here which I think may be related to the problem is that under Include Path, the /var/www/magento/pub directory is not shown. That's what PhpStorm is referencing on that first error I described above. It's like PhpStorm found some of my directories with PHP files, but not all of them.
3) Here is the XDebug log
Update 2:
Here is what my project looks like
Here is my Directories window
I'm assuming that the reason that all the vendor/... directories are under Excluded Folders is that they are in .gitignore. Some of the code that I'm setting a breakpoint in is in a subdirectory of one of the vendor directories and some of the code is in a subdirectory of app/code/ (which is under Source Folders)
I added /var/www/magento2/pub to the Include Path under Settings > Languages & Frameworks > PHP. That eliminated the error about /var/www/magento2/pub/index.php. Now it's partially working. If I have PhpStorm break on the first line of PHP scripts, the debugger does start as soon as I refresh my page. However, after I step over the first line of code, I get the error PHP CS Fixer: Can not correctly run the tool with parameters... and then the debugger seems to stop working.
If I don't select Break at first line in PHP Scripts, and I put a breakpoint further into my code, I still get the same "debug session was finished without being paused" error.
I'm not sure what PHP CS Fixer is, nor do I want it to run. Is there a way to disable that?
I used to be able to stop on break points during my PHPUnit runs, but a recent PhpStorm update has messed that up. I am able to use xdebug_break() but not an IDE break point.
Anyone else had that issue?
I got it working by fixing my config.
Go to: Preferences->Languages & Frameworks->PHP->Servers
Make sure the 'Absolute path on server' correctly correlates to your project.
Mine was blank so I had to set it.
When I run a test using PhpUnit from PhpStorm it doesn't stop on my breakpoints. Any suggestions?
If your debugger seems to be connected, then you need to confirm whether your breakpoints are disabled. Make sure that the checkpoint in front of breakpoint is enabled.
The link below has more information on ensuring path mapping is correct.
These might help:
https://confluence.jetbrains.com/display/PhpStorm/Troubleshooting+PhpStorm+debugging#TroubleshootingPhpStormdebugging-Breakpointsarenotbeinghit
Similar question is answered here as well. You can check it out:
PhpStorm debugger not stopping at BreakPoints; keeps waiting for xdebug _SESSION_
Good Luck
I am not able to debug my Karma unit tests in WebStorm. How can I fix it?
I see this message when I click the debug button:
I checked How do I know what's wrong. chrome://extensions shows:
Clicking 'background page' shows:
This SO question showed answers which helped me realize the solution.
The problem was that the JetBrains plugin was trying to debug on port 63343 (not sure why). I noticed Webstorm was serving on port 63342.
To fix the port mismatch, I opened the chrome://extensions tab, found JetBrains IDE plugin, clicked "Options". This opened a new tab where I could adjust the port that the JetBrains IDE plugin was using. I set the port to be the same value that Webstorm was using, then I clicked Apply.
I have the Sublime Text 2 XDebug plugin installed but the stack and trace panes are empty no matter what I do. The menu works after pressing shift+f8. The "add breakpoint" also works. However, whenever I select start debugging I get directed to my browser with the standard debugging info but nothing appears in the panes in Sublime Text.
I am on Win7 x64
WAMP Server 2.2 : PHP 5.4.3 + Apache 2.4.2
I checked via phpinfo() and xdebug_is_enabled() and xdebug is installed and running.
my current configuration (bin/apache/[apache...]/bin/php.ini, ofcourse:
zend_extension = "[wamp path]/bin/php/php5.4.3/ext/php_xdebug-2.2.0-5.4-vc9-
x86_64.dll"
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_autostart = On
;Trace settings
xdebug.auto_trace = On
xdebug.profiler_enable = On
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "[wamp path]/wamp/tmp"
Do note that the path to the extension is correct. The name of the extension itself is as above also. I checked this page a link but still nothing.
Any help with this would be appreciated. Thanks!
I had the same problem. My setup is Sublime Text 2 on a Mac.
In Sublime, goto View, Sidebar, Show Open Files.
Insert an XDebug breakpoint in your file. Start a debug session from your browser.
It should hit the breakpoint, which turns green.
Notice in the Sidebar files called, Xdebug Watch, Xdebug Stack, Xdebug Context and Xdebug Breakpoint.
Open one of these, say Xdebug Context, you should see a listing of variables.
Drag the tab for this file into one of the empty panels below
And voila!
I fixed my sublime xdebug that was not showing debugging info.
I am using MAMP and ST3.
Xdebug client in sublime text come with super_globals = true i just changed the setting in Xdebug user setting and it worked!
Go to Tools -> Xdebug -> Settings - User and add following lines
{
"super_globals": false,
}
The first thing to try to see which end is broken would be to create a "debug log". You can do that by making the setting:
xdebug.remote_log = /tmp/xdebug.log
And then restart your web server.
Once debugging starts, the file should contain debugging commands and responses and it will tell you whether connections were made, or failed.
If you update your question with the results, I'll update the answer if something on the Xdebug side is wrong.