I'm having this weird problem. All my settings used to work OK, until I updated my version of PHP. I use macports and have the php5 and php5-xdebug ports installed.
xdebug is working, but it is stopping on the first line of my script even though I have the option disabled in PhpStorm. There is no breakpoint there, and breakpoints in other parts of the code are working OK.
If it helps, here is the xdebug portion of phpinfo (in two parts);
https://dzwonsemrish7.cloudfront.net/items/3K3R2N1f1A190K372n0S/Screen%20shot%202011-08-18%20at%203.06.29%20PM.png?v=54c8964d, https://dzwonsemrish7.cloudfront.net/items/0i133s0U430k3u3w3B1E/Screen%20shot%202011-08-17%20at%205.14.25%20PM.png?v=1278da84 and the proof it is disabled in phpStorm: https://dzwonsemrish7.cloudfront.net/items/3W2S060I1b0W1q0z0c45/Screen%20shot%202011-08-18%20at%203.07.00%20PM.png?v=85471026
Is there an xdebug setting I need to change? When I did the upgrade, I lost my php.ini that had some other xdebug configuration.
The above didn't work for me because as far as I can tell if you're using Xdebug the only debug bookmarklets you get is start/stop and debug this page. I don't see any bookmarklet specific to stopping on first line, and neither the start/stop bookmarklets nor stopping PHPStorm from listening within PHPStorm fixed the problem for me.
To get it to stop I did this (on OS X):
Go to Preferences > Languages & Frameworks > PHP > Debug
Uncheck both of the 'force break at the first line...' options
Apply and close
In the Run menu, uncheck 'Break at the first line in PHP scripts'
For example, even if you have Path-Mappings, the public/index.php path may not be considered as part of the project.
Check the "Force break at the first line..." in the PHP->Debug section of preferences.
BESIDES THAT, also check this setting:
My problem with PHPStorm was that I was doing Drupal and the index.php was outside the project (since the project is a module). I needed to uncheck the settings "Force break at the first line..." in the PHP->Debug section of preferences.
Do you use debug bookmarklets? 'Break at the first line' option could be also controlled via 'xdebug Break On' and 'xdebug Break Off' bookmarklets.
Related
I am using UniServer Zero XIII with PHP 7.1. From the phpinfo.php file, I can see that xdebug enabled:
When I try to debug the source code and use a breakpoint on NetBeans, the XDebug session never completed:
When I go to see the execution of the web application from the web browser, it keeps trying to load the page, but it never completes.
I experience the same on Eclipse:
I am trying to understand why the Xdebug session never completes, and what I need to do to fix it. Thank you.
I think maybe found the solution, the problem was that you deleted the metadata:
When a project (including the source roots) is deleted or moved outside of NetBeans and while NetBeans are closed, then after NetBeans are started again, line breakpoints belonging to sources which do not exist any more are deleted.
Therefore, IMHO, in your case either some exceptions were thrown, which interrupted the breakpoints elimination and which would be in your messages.log file, or you've deleted just the project metadata without the sources.
And this is the only case in which I'm able to reproduce your issue:
1) Create a Servlet2Stateless sample project (or any Java project should work
this way IMHO)
2) Right-click on the project in Projects window and select Copy...
3) Press Copy button
4) Open Servlet2Stateless.java file from the copied project
(Servlet2Stateless_1)
5) Submit breakpoint to line 72
6) Debug the Servlet2Stateless_1 project, after it suspends on the
breakpoint, press continue and finish the debugger session.
7) Delete your proyect_1 project, but be sure not to check on
"Also delete sources under..."
8) Debug the original project
9) You get en error message
"Not able to submit breakpoint LineBreakpoint Servlet2Stateless.java:72,
reason: No source root found for URL
'file:/tmp/NetBeansProjects/ServletStateless_1/src/java/servlet/stateless/
Servlet2Stateless.java'. Verify the setup of project sources."
10) This message is harmless, but if you want to get rid of is, it's easy
to click on "Invalid LineBreakpoint Servlet2Stateless.java : 72" line,
which opens the source file and remove the breakpoint.
Since there is nothing severe in this issue, I'm reducing the priority to P3.
We can think about fixing this by ignoring breakpoints that belong to source roots without a corresponding project and not being added as an extra source root in the Sources window.
Check the whole info here
I ran out of time to find a solution to this problem. Unfortunately, I only received one answer to this question, and it did not solve my problem. I had to purchase a Zend Studio Perpetual license for Zend Studio 13.6, and now I can use breakpoints, debug my code using Zend Debugger (the competitor of XDebug), and everything works correctly.
I tried as much as I could to fix the problem I experienced with XDebug on both NetBeans and Eclipse, but I ran out of time and I needed to move on. I had to pay $89 for my Zend Studio Perpetual license, which includes free upgrades for one year. I wanted to save money by using Eclipse or NetBeans, but this XDebug issue forced me to move from an open source to a proprietary solution in this case.
Edited on August 29th, 2017:
I finally have XDebug working on Zend Studio. I could not quickly configure Zend Debugger on UniServer Zero XIII, so I did the modifications that I am showing below, to the following file: C:[my path]\UniformServer13_3_2_ZeroXIII\UniServerZ\core\php71\php_production.ini:
[xdebug]
#zend_extension=${US_ROOTF}/core/php71/extensions/php_xdebug.dll
zend_extension="C:\[my path]\UniformServer13_3_2_ZeroXIII\UniServerZ\core\php71\extensions\php_xdebug.dll"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
#xdebug.remote_port=9000
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=default
I changed the port from 9000 to 9001, and used an absolute path with double quotes to the zend_extension to specify where the php_xdebug.dll extension is located. I am not sure if this last step made any difference, or if only changing the port from 9000 to 9001 and then restarting Apache. But at least now I can configure breakpoints to stop the program there and see the values of variables I want to evaluate.
I am attempting to debug a site (hosted on a remote server) from my local machine. I have xdebug installed on the remote machine and enabled remote debugging and auto start options for the xdebug extension.
In some ways it appears to make a connection, the site loads fine, the "debug" icon to right of the browser's search bar is highlighted, and the "styled" error messages even appear. However, it absolutely will not stop at any breakpoints.
I would greatly appreciate any guidance.
Relevant parts of php.ini (on the remote server)
; This setting is on by default.
report_zend_debug = 1
zend_extension = C:\Program Files\PHP\v5\ext\php_xdebug-2.4.1-5.6-vc11.dll
[PHP_XDEBUG-2.4.1-5.6-VC11]
xdebug.remote_enable=1
xdebug.remote_autostart = "On"
xdebug.remote_port=9000
Previously, before I put the applications on a remote server, the debugging worked fine. I have done some looking around and reading up on how it should be done, but with no success.
A few things I noticed that could solve your problem:
First of all there are usually no spaces between the key and the value in .ini files. I'd recommend to remove them since this might cause problems. Furthermore, remote_autostart expects a boolean, not a string. Change it to
xdebug.remote_autostart=1
You also need to tell Xdebug where the debug client is running, so add:
xdebug.remote_host=<ip.of.your.local.machine>
Another option would be to set xdebug.remote_connect_back=1 instead, which is simpler but also less secure (since anybody who can connect to the server can run a debug session). So if possible use remote_host.
Also make sure that the firewall (on either machine) is properly configured and doesn't block anything and that all Xdebug settings match with your settings in Netbeans.
Hope this helps
I have multiple virtual hosts on Apache all pointing to my local machine but different folders:
http://local.demoA.com (pathA)
http://local.demoB.com (pathB)
http://local.demoC.com (pathC)
All paths are part of the same project folder structure in IntelliJ but I am having difficulty starting a debug session which hits a URL from demoA and within that the js side of the page calls demoB URL. Makes sense?
I have managed to setup IntelliJ to break on demoA above but will not for demoB.
On the other hand MacGDBp seems to support this (though wont work without setting it to break at first line of execution).
Turns out it was more simple than I was making it out to be.
What I did is enable the "Start listening to PHP Debug connections" (two icons after debug on the toolbar).
As soon as a connection comes through (assuming XDebug is configured to run) IntelliJ will automatically prompt you to attach and listen and it will also setup the needed server for you for the virtual host.
I still haven't found a way to break only on my breakpoints nor a way to start debugging demoB calls when starting a debug session for demoA host but at least I am getting typical XDebug behaviour of breaking on every entry line.
Update
Found this for first line breaking:
How to stop xdebug from stopping on first line with PhpStorm?
As such, simply start listening stop breaking on first line and set your breakpoints wherever you want and ready to go!
I have tried to set up Xdebug (2.2.3) with PhpStorm 7.0 and I cannot bring up the step-through debugging console as I have in the past. The guides that I have used to set this up are:
https://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html
http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/
I know that the Xdebug extension itself is working as the cachegrind.out.3280 files are being created on page load (with 12Mb litany of all of the scripts required and variables/values). My set up in php.ini (php version 5.4.12) is:
zend_extension="c:/wamp/bin/php/php5.4.12/zend_ext/php_xdebug-2.2.3-5.4-vc9-x86_64.dll"
xdebug.profiler_output_dir="c:/wamp/tmp"
xdebug.profiler_output_name="cachegrind.out.%p"
xdebug.profiler_enable=1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.idekey=xdebug
xdebug.remote_connect_back=1
xdebug.remote_host=dashboard.dev
After setting a break point, turning on Xdebug chrome extension, clicking to listen to Xdebug within PhpStorm and refreshing, I get the Incoming Connection from Xdebug dialogue:
However, when I click Accept, the dialogue disappears and nothing happens.
If I then go to Settings / PHP / Servers in PhpStorm, I see that a new entry has been created:
Only by deleting the entry that was added can I get the Incoming Connection dialogue to show up again when I refresh the page. I notice that the port is set to 80 so wondering if that is right since the Xdebug extension is set to run over port 9000; when I click "Validate remote environment" select deployment server, then "Validate", I get: No debug extension is loaded. So I am assuming that the problem is something related to how this is set up.
The problem was fixed by adding the break points to other parts of the code as it was not working when attached to the try clause. Additionally, here are some other tips that might be useful:
Try using a programmatic breakpoint: xdebug_break();
Check that if your php is 32bit then so is the version of Xdebug (or that they are both 64 bit).
The xdebug remote host setting relates to the server IP address (so 127.0.0.1 for local).
You need to configure the mapping between server path and local path in preferences / server
In your Phpstorm goto File > Settings > Languages & Frameworks > PHP > Debug.
Under External conections section, mark the checkbox saying
Ignore external connections through unregistered server configurations
This was fixed for me.
Im trying to configure xdebug to work with Netbeans 6.9 and php 5.3
As far as i concern i have setup xdebug properly.
I can see xdebug extension from phpinfo page.
I have read other post and tried their suggestion but up to no avail
When i hit the debug button, it straight open the page in the browser and i can see message 'Waiting for connection' in the bottom pane of netbeans
Here my setting in php.ini
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
Any help would be appreciated
First, check that it isn't actually working for you, and you don't notice. I've done this...convinced it's not working I wasted a chunk of time trying to get it to work, only to find that everything was OK.
Look at your NetBeans status bar. If you see "netbeans-xdebug" and "running" then it is actually working just fine. You probably have the "Stop at first line" option turned off and you didn't hit any breakpoints you set (if any) yet. That would be a reason you are seeing the page with little or no indication that the debugger is actually connected.
If you instead see "Waiting for Connection (netbeans-xdebug)" and the progress bar is cycling, then you are indeed not connected. Open Tools|Options, and go to the PHP page. On the general tab, make sure that the "Debugger port" is 9000 and the "Session ID" is "netbeans-xdebug". You may want to have "Stop at First Line" checked. I don't, as I find it a bit annoying. I would definitely ensure that "Watches and Balloon Evaluation" is not checked. This option causes NetBeans and the debugger to destabilize. If you need a watch, hack a local variable into the PHP code where you need it, and you'll see it on the "Variables" tab when the debugger is running. Also, confirm that file (index.php) is specified in the project's Run Configuration > Index File.
Since you see xdebug in phpinfo(), that end of it is fine. Just make sure that all of the values look reasonable, and that there is some reference to a cookie "XDEBUG_SESSION=netbeans-xdebug" somewhere on that page. (Make sure that you don't have cookies turned off on the browser!)
The only other thing to check is to see if some firewall/security program is running that would be blocking TCP/UDP locally (which would be super-odd, but not out of the realm of possibility), or that port 9000 isn't already used by another application. I am using a different port number in my local setup for some reason. I don't remember changing it, but I am sure that the only reason I would have is if I had hit a port conflict with something else.
One last thing... We've been assuming that you are running NetBeans and the web server on the same computer. That's a common configuration, but not the only one. If your web server is on a different computer, then change the localhost in xdebug.remote_host=localhost to the IP address of the computer on which NetBeans is running.
Another last thing: When cycling through frustrating iterations, until you see xdebug info in phpinfo(), restart apache/php. Once there, still restart NetBeans between iterations. And believe it or not, restart your browser.
For me it was changing
;xdebug.remote_enable = 0 (default value in clean XAMPP installation)
to
xdebug.remote_enable = 1
did the trick
Adding an index.php did the trick for me.
I couldn't figure out why some of my projects would connect to the debugger and others wouldn't. Then I realized that the ones that wouldn't connect started with index.html. Once I renamed these files to index.php, the debugger connected with no problem.
I solved this using a windows -> remote LAMP server config after reading the following post, leaving the link in case anyone finds it handy:
http://stuporglue.org/setting-up-xdebug-with-netbeans-on-windows-with-a-remote-apache-server/comment-page-1/#comment-6227
Having just upgraded to the new Ubuntu 14.4 my NetBeans Xdebug stopped working. I've followed all the answers above to date to no avail.
I found a NetBeans Ubuntu statement that the /etc/php5/cli/conf.d/xdebug.ini file should have xdebug.remote_enable=on. When I checked the /etc/php5/cli/conf.d directory, I found no xdebug.ini file. However there was a link to /etc/php5/mods-available/xdebug.ini there.
Subsequent adding the xdebug.remote_enable=on to that file fixed the problem.
PS - This works on NetBeans 8.0.1
When I tried to debug the Yeoman WebApps powered by PHP backend in Netbeans, the status keep showing 'Waiting for connection'. There's probably because the index.html has nothing to do with php at all. It's only when I've triggered the ajax which needed PHP processing, the connection with xdebug immediately connected and debug as usual. Hope this give another perspective to someone as I have stumbled to 'think' there is a problem and trying to fix the ini.
An alternative is the Dephpugger project. Is like ipdb in python or byebug in Ruby.
https://github.com/tacnoman/dephpugger
Is very easy to use.