I get the message "waiting for connection (netbeans-xdebug)" when using netbeans debugger.
I am using:
Windows 10
XAMPP for Windows 5.6.20
XAMPP control panel v3.2.2
NetBeans IDE 8.0.2
I have been round and round the forum answers for days trying everything but have drawn a blank.
The code in php.ini is :
> [XDebug]
; Only Zend OR (!) XDebug
zend_extension = c:\xampp\php\ext\php_xdebug-2.5.4-5.6-vc11.dll
xdebug.remote_autostart=on
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
xdebug.profiler_enable=1
xdebug.profiler_output_dir="c:\xampp\tmp"
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
I have tried every combination of parameters for the above imaginable.
The port I have used in netbeans is:
project properties > Run Configuration > Advanced: 9001
Netbeans > Tools > Options > PHP > Debugging : 9001
Could it be significant that the debugger is using the Chrome browser, but my phpmyAdmin and the home screen for XAMPP are on IE?
I'm not sure about Windows, but in later versions of PHP on linux (starting from at least 5.4) the xdebug configuration is in a separate file. Mine is in:
/etc/php/7.0/apache2/conf.d/20-xdebug.ini
If you don't have a dedicated xdebug ini file, make sure you are editing the right php.ini. In my system there are 3:
/etc/php/7.0/apache2/php.ini
/etc/php/7.0/cli/php.ini
/etc/php/7.0/phpdbg/php.ini
Here is my xdebug configuration:
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.show_local_vars=on
A few considerations:
I see your port is different from mine (9000 vs 9001). Go to Tools->Options->PHP, at the "Debugging" tab make sure the "Debugger port" corresponds to the one specified in xdebug.remote_port.
Try to use localhost instead of 127.0.0.1
Make sure the output of phpinfo() contains information about xdebug. If you don't have an "xdebug" section you probably need to check the zend_extension path.
I remember reading on the NetBeans mailing list that a few people had problems caused by the Windows firewall, maybe you can try to disable it.
A lot many people facing the same problem. This awful error/bug seems from Netbeans itself not from X-Debug. I also faced the same problem with Netbeans.
Your php.ini file configuration looks fine. Try #paolosca's answer. If that didn't work try the below suggestions.
After right click on your project name in Netbeans and select Properties -> Run Configurations
Now you'll see project run configurations. There select index file (Ex, index.php) then in Arguments field pass
XDEBUG_SESSION_START=netbeans-xdebug
as argument to index.php file. That you should start debugging the PHP code.
If you think it's a long way you can directly pass the arguments as below. Say you have the url like,
http://localhost/foo-project/index.php
then pass the argument like this in browser's url window
http://localhost/foo-project/index.php?XDEBUG_SESSION_START=netbeans-xdebug
and hit Enter.
To answer your last question
Could it be significant that the debugger is using the Chrome browser, but my phpmyAdmin and the home screen for XAMPP are on IE?
I don't think so.
This might help someone in the future, if the above did not help. Turn off the "Personal Networks Firewall" in Windows Defender in Windows 10:
Control Panel\System and Security\Windows Defender Firewall
After spending hours and hours trying everything without success, this finally did it for me...!
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 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.
I am trying to get xdebug working with eclipse (3.5) / php (on xampp windows 7). I have verified xdebug is enabled in php - I have the fancy output and my phpinfo shows all the xdebug stuff. I have remote debug on, and typed in the lan ip address on my eclipse machine.
When I tell eclipse to debug, it launches the browser and passes the debug URL parameters. That looks OK.
However, in eclipse debug perspective it shows 'launching myproject' 57% 'waiting for xdebug session'. It sits there forever.
I have turned off windows firewall on both machines.
I tried turning implicit flush on.
Any ideas?
I had this problem too and I was missing this line in the php.ini file:
xdebug.remote_enable = On
Make sure you defined zend_extention with ABSOLUTE path in the php.ini:
e.g.: zend_extension=D:\SANDBOX\server\php\php_xdebug-2.1.0-5.3-vc6.dll
I'm debugging a local project on Windows. So far I did not need xdebug.remote_enable = On.
Suggestions if the Xdebug session does not start (hangs at 57 %), make sure that:
zend_extention directive is set with absolute path and the debug is loaded, use phpinfo() to check
firewall does not block the default 9000 port or Eclipse.
another application is not using the port (execute: netstat -an |find /i "listening" from the command line)
If you need to setup a different port use in php.ini:
xdebug.remote_enable = on
xdebug.remote_port = XXXX
and correct the Xdebug settings in Eclipse:
I had the same problem and I fixed it by changing the port to XDebug (now using port 9001).
Here is my php.ini content:
zend_extension ="C:\...\EasyPHP-5.3.3\php\ext\php_xdebug-2.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.remote_mode=req
xdebug.remote_autostart=0
Also check the apache log file and make sure that you don't have the following Warning message:
PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
If you do, open the php.ini file and comment with a ';' the extension=php_xdebug-2.dll line:
;extension=php_xmlrpc.dll
extension=php_xsl.dll
**;extension=php_xdebug-2.dll**
;/PHPExt
After fighting for 3 hours and trying out every solution on forums, I found out that the simple trick was to remove the quotes while specifying the path of the Xdebug dll in zend_extension in php.ini. I am using XAMPP (PHP 5.3.6 + Apache 2.2)+ Eclipse Indigo + PDT + Xdebug 2.1.2 on Windows Vista.
Here is the exact configuration that worked for me -
zend_extension=C:\xampp\php\ext\php_xdebug-2.1.2-5.3-vc6.dll
#Note that the path above is not in quotes
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=C:\xampp\tmp
I have used port 9001 so that it does not clash with 9000 in case that's already used by another program. Make sure this matches the port in Eclipse > Preferences > PHP > Debug > Xdebug too. Also, restart apache after editing php.ini.
Once I added this to php.ini, everything worked like ice cream.
I had the same problem with Zend Studio. I have noticed that the xdebug session was not starting properly. I passed this string to the url once and it worked since then.
http://localhost/myalias/?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=13750956767461
I'm sure it's a matter of configuration somewhere in the IDE.
I realized that TCP port was in use and that was the reason why it was hanging. I changed port in php.ini and eclipse settings.
Check that Eclipse's web browser settings are correct.
Window/Preferences/General/Web Browser/external Web Browsers/Edit settings
In my case, the path to the external web browser binary was incorrect. It said "/usr/bin/mozilla" instead of "/usr/bin/firefox".
Don't know how this setting came about, but after changing it the firefox browser window came up at last.
I looked into apache log and there were many lines with file not found error.
Run -> Debug configurations -> PHP web page -> Your_configuration
I unchecked auto generate and set filename to index.php.
It seems that in case of any mistake that prevents eclipse from normal functioning causes this "waiting for session"
I had the exact same problem. My configs were par with yours and in addition to having xdebug.remote_enable = On in the php.ini file also adding the following:
xdebug.remote_connect_back=1
this enables multihost remote debugging, as an alternative you can define the host IP.
xdebug.remote_host=IP_ADDRESS
For me, adding the [xdebug] configurations suggested by others to a php.ini file kept in following path C:\wamp64\bin\apache\apache2.4.23\bin helped. Essentially it's a symbolic link that points/links to phpForApache.ini file under your respective php version folder that gets installed with wamp64 e.g. php5.6.25.
In nutshell, adding following lines phpForApache.ini to helped me -
zend_extension = c:\wamp64\bin\php\php5.6.25\ext\php_xdebug-2.5.1-5.6-vc11-x86_64.dll
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
Hope this helps
Yeah, check network/port stats. In my case I'm using vmware fusion on mac, and the process vmware-natd was hogging the cpu (blocking on an open port I'm assuming), which I didn't notice. php.ini was completely fine, had to run this to get it to work again:
sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
So ppl check your php.ini (or xdebug.ini) file first. If it looks ok ala this discussion, then check that you're not having networking issues.
I don't know this means to you anymore or not! But, did you hit to a PHP file (anything.php) with right debug parameter, something like XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=12882809194391.
People often make mistakes to hit a HTML file with the debug parameters which causes Eclipse to hang at xdebug session
I had a similar problem and it turned out I was using the wrong dll. Hope that helps someone in the future.
I had the same symptom. However, my problem was that I set
xdebug.remote_host = ""
I did this because I'm using apache virtual hosts to eliminate the need for localhost. However, I had change it back to
xdebug.remote_host = "localhost"
and then change my apache/etc/hpppd-vhosts.conf to have localhost point to my root c:\web.
For me, these symptoms were caused by the windows firewall (Win7 Pro). I needed to explicitly allow eclipse to pass the firewall. I did this via the dialog at "Control Panel\All Control Panel Items\Windows Firewall\Allowed Programs".
It might not be useful to everybody, but... when trying to debug remote hosts, always remember the DSL router! (or any router along the way) I spent hours trying to find a solution, when I noticed that all I had to do was to activate port forwarding (port 9000) on my Linksys and everything worked like a charm :)
The above inputs were useful. I checked xdebug parameter values in phpInfo() and found that despite my settings to 1 or On, auto_trace and remote_enable were off. So i made it to true. And then remote worked!. Thanks.
Note, now you can launch the remote debugging session from within Eclipse by configuring various Debug configurations OR/and whenever you launch your such configured application outside Eclipse, you will get a question at Eclipse to accept or not to accept the debug session. So if you are on a different machine than of the eclipse UI you might find that the call to your application is getting timed out for no reason. Actually there would be a yes - no dialog box wherever the Eclipse session is
This thread helped me sort out my issue with MAMP on OSX with Eclipse. After upgrading to MAMP 2.1.1 from the 1.x release, I was not able to get xdebug to work in eclipse. It was hanging at the 57% level.
phpinfo showed that xdebug extension was loading fine and there were no errors in the PHP or Apache logs.
I only wanted to debug locally but the reason for the issue was that remote debugging was not enabled. Adding xdebug.remote_enable=true to the MAMP PHP.ini template and restarting MAMP solved the issue.
In my case CLI application was working fine, but it was the web application which was getting stuck at 57%.
It worked after 2 changes:
made server debugger as XDebug
Auto Generate URL true.
If Netweaver/Eclipse fails to connect to XDebug, you may wish to check the Apache logs for occurrences of something like: Cannot load Xdebug - it was built with configuration API220090626,TS,VC6, whereas running engine is API220090626,TS,VC9
[Fri Jun 01 18:38:05 2012] [notice] Child 3404: Child process is running
To remedy this, pick the right version of the XDebug binary from the XDebug website (try a few combinations till you get it working)
Before eclipse setting, Check out the following content is visible in phpinfo function.
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
I too encountered the same problem. I double checked all the settings in php with the output of phpinfo() and everything was fine.
Allowing Java(TM) Platform SE binary through the firewall did the trick.
Check out the commands from this question, they are very useful for debugging!
I've tried every possible solution on this post to get xdebug to work on a site running on Apache (http port 8000) to no avail. I then accidentally noticed that xdebug was working on another site that I had running on port 80. As soon as I changed the other site to port 80, it finally allowed me to debug it.
I wonder if there's a setting that can direct Apache to allow xdebug on other ports than just 80. I have more than one site running in Apache and would like to debug each of them without having to reconfigure the ports. Anyone had this issue before? or knows how to fix it?
If your configuration is ok, just delete the file :
YOUR_WORKSPACE/.metadata/.plugins/org.eclipse.core.resources/.root/.markers
Had same issue using Uniserver Zero XIII 13.2.0 (requires MS VC12 redistributable install) and Eclipse Neon Release Candidate 3(4.6.ORC3). Our website uses phalcon, when we found an issue with the phalcon.dll and php7.0 we dropped back to php5.6. We verified xdebug settings above, added zend_extension=$(US_ROOTF)/php56/extensions/php_xdebug.dll--would not connect, no break points.
Found a warning at top of Eclipse Dialog Project | Properties | PHP | Debug | Configure Workspace Settings... | PHP Executables | PHP56(Workspace Default) | Edit | Debugger | "XDebug extension is not installed. Please visit http://xdebug.org...". This made us suspicious of the version of the php_xdebug.dll (2.5.0) in the Uniserver 13.2.0 php56. I downloaded php_xdebug-2.4.1-vc11.dll, dropped it in /php56/extensions and PRESTO! Eclipse PHP Debugger works!
Here is another blog which mentions how to verify if Xdebug is properly installed or not via the command line
http://allcodeverything.blogspot.com/2012/07/code-debugging-with-xdebug-and-eclipse.html
It mentions this
If you want to figure out if everything worked well, here is a nice piece of code that you'll run through the CLI (command-line interpreter, basically outside of Apache or a browser; just pure PHP) after you have typed the following in your browser: "http://localhost/dbgtest.php?XDEBUG_SESSION_START=ceable"
<?php
$address = "localhost";
$xdebug_port = 9000;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $xdebug_port) or die('Unable to bind');
socket_listen($sock);
$debug_client = socket_accept($sock);
echo "connection established: $debug_client";
socket_close($debug_client);
socket_close($sock);
?>
The command-line window should print something like "connection established: Resource id #5".
UPDATE 2:
Nevermind, figured it out, in netbeans I had an extra ) in tools > options > general > web browser > edit > arguments was -remote {url}), so I changed it to -remote {url}.
I now have netbeans debugging php on my new laptop.
UPDATE 1:
I've been comparing my old laptop with my new laptop as debugging works on my old laptop. The only difference I have seen is the url in the browser when I click debug.
Old laptop:
http://localhost/PhpProject1/index.php?XDEBUG_SESSION_START=netbeans-xdebug
New laptop:
http://localhost/PhpProject1/index.php?XDEBUG_SESSION_START=netbeans-xdebug)
When I remove the ending ) from the new laptop url manually, debugging starts to work... Why does the new laptop setup have an ')' at the end and the old setup doesn't?
ORIGINAL QUESTION:
I'm trying to configure xdebug for php debugging via netbeans on a localhost. I have tried following a couple of guides, but can't seem to get it to work. I've had it configured on an old laptop, but can't seem to remember how. At the moment, when I add a breakpoint and click "debug project", it opens up a browser and displays waiting for connection (netbeans-xdebug). The "step over" and "step into" options are disabled.
How do I resolve this issue?
I have done the following so far:
I have installed lamp, php5-xdebug, and the php plugin for netbeans.
I have the following in /etc/php5/apache2/conf.d/xdebug.ini:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_enable=1
I have done service apache2 restart.
I can see that xdebug is enabled with phpinfo();
In netbeans - tools > options > php, I have done the following:
PHP 5 Interpreter = /usr/bin/php
Bebugger Port = 9000
Session ID = netbeans-xdebug
Sounds like netbeans is waiting for php to callback. Did you add xdebug to php?
For more info see this article
The solution to the problem can be seen in update 2 in the original question, which is:
In netbeans I had an extra ) in tools > options > general > web browser > edit > arguments was -remote {url}), so I changed it to -remote {url}.