I read a lots of solutions for this common Xdebug's error, but it did not seems to resolve my issue:
netbeans shows “Waiting For Connection (netbeans-xdebug)”
Netbeans not connecting with xdebug on Wamp : “showing waiting for connection”
in phpinfo() Xdebug seems properly configured:
And below is my php.ini:
zend_extension = "c:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5
-5.5-vc11-x86_64.dll"
;
[xdebug]
xdebug.remote_enable=1
xdebug.remote_mode = req
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.show_local_vars=0
xdebug.idekey=netbeans-xdebug
Netbeans:
Tried disable firewall doesn't seems to help.
Running out of ideas to know what is going on with my Xdebug.
Once you start debugging , Check in your command prompt that netbeans is listening on port 9001 :
C:\Users\***> netstat -ano | findstr 9001
TCP 0.0.0.0:9001 0.0.0.0:0 LISTENING 20928
TCP [::]:9001 [::]:0 LISTENING 20928
the PID in the end (20928 in my case) should belong to netbeans, this can be verified from Windows task manager (after adding pid : view > select columns > pid)
If the PID is not correct or the port is not up., restart netbeans or restart system and it will work
If netbeans has the 9001 port, this means your browser is not listening or getting attached to netbeans. Sometimes browser cannot establish the connection or cannot start properly.
In order to manually attempt a connection , you need to press the debugging button in netbeans and within the next minute or so(before it times out) open the following url in your favorite browser (try different browser if one fails)
localhost/<yoursite>/page/?XDEBUG_SESSION_START=netbeans-xdebug
You may also try switching to embedded browser in netbeans project properties.
You can also try changing the port from 9001 to something else , eg 9002 on both sides , this helps if some other program is trying to connect to port 9001 or trying to listen on this port.
Set
zend_extension = "c:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5
-5.5-vc11-x86_64.dll";
inside the [xdebug] section , not outside.
remove ; from the end.
wrong:
zend_extension = "c:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11-x86_64.dll";
[xdebug]
xdebug.remote_enable=1
.....
right:
[xdebug]
zend_extension = "c:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11-x86_64.dll"
xdebug.remote_enable=1
.....
also try
zend_extension_ts="c:/.../php_xdebug-2.2.5-5.5-vc11-x86_64.dll"
instaed of
zend_extension="c:/.../php_xdebug-2.2.5-5.5-vc11-x86_64.dll"
Finally, managed Xdebug to work follow this article, and one more thing i need to do is when netbeans showing "waiting for connection" message. I need to open the page manually in browser(netbeans not open pop-up itself), added index.php?"XDEBUG_SESSION_START=netbeans-xdebug" to the URL and refresh the page, and then netbeans Xdebug status changed to running right away :)
Thank you guys so much for valuable helps!!!!
Related
I'm trying to connect PhpStorm and debug PHP scripts/webpages with Xdebug, something I've done several times.
This is my php.ini file (the interesting bit):
[xdebug]
zend_extension=C:\xampp\php\ext\php_xdebug.dll
xdebug.remote_enable=1
xdebug.remote_port=10000
xdebug.remote_mode=req
I set multiple breakpoints and called xdebug_break() on my index but code execution is not stopping at them.
This is the PhpStorm validation script output for Xdebug:
The output of netstat which shows that PhpStorm is listening on port 10000:
Change
from
xdebug.remote_enable=1
xdebug.remote_port=10000
xdebug.remote_mode=req
into
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_port=10000
Change the lines in the php.ini to
xdebug.mode=debug
and set the port on PhpStorm to listen on 9003 instead of 9000.
In xdebug v3 the default xdebug port was changed to 9003:
https://xdebug.org/docs/upgrade_guide#Step-Debugging
Netbeans won't connect to xdebug. I've tried suggestions from the following posts:
Debugging IDE's port connection to XDebug: "Waiting to Connect"
netbeans shows "Waiting For Connection (netbeans-xdebug)"
but it doesn't fix my issue.
It seems Netbeans connects to xdebug because while it waits for the connection all request made to the webserver [Apache2] are blocked. Also the port [9001] appears to be in use:
roxy#Pixy011 ~ $ sudo nmap -sS -O 127.0.0.1
Starting Nmap 6.00 ( http://nmap.org ) at 2013-11-28 20:48 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000029s latency).
Not shown: 990 closed ports
PORT STATE SERVICE
22/tcp open ssh
139/tcp open netbios-ssn
443/tcp open https
445/tcp open microsoft-ds
631/tcp open ipp
902/tcp open iss-realsecure
3306/tcp open mysql
8080/tcp open http-proxy
8081/tcp open blackice-icecap
9001/tcp open tor-orport <---- Opened by java
xdebug.ini: [I have confirmed it is loaded in phpinfo()]
zend_extension=/usr/lib/php5/20100525/xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9001
xdebug.idekey="netbeans-xdebug"
Netbeans configuration:
Debugger port: 9001
Session ID: netbeans-xdebug
Stop at first line: Checked
All other options are unchecked
Project properties:
Host: 127.0.0.1
Port: 9001
Edit:
I've noticed Netbeans doesn't append the XDEBUG_SESSION_STOP to the URL. I don't think this is related to the issue because Netbeans only opens the page after I close the debugging session.
I've also disabled SELinux
On Ubuntu 13.04 64bit php 5.4.9-4 Xdebug v2.2.3 netbeans 7.4
I have same problem and have solve it by:
1. go on http://xdebug.org/wizard.php follow the instructions to compile your own xdebug.so
2. in netbean 7.4 general options (sorry I haven't reputation 10 to post image)
test connection. be sure correct settings on Proxy:
to me "No Proxy" is working.
3. in php options debugging tab change xdebug setting port to other than 9001 or 9000.
I choose 9002 but you can try until you find a free port (if port is not free nb tell you)
4. in php.ini OR for ubuntu users in /etc/php5/conf.d/20-xdebug.ini
zend_extension=/usr/lib/php5/20100525/xdebug.so #where you ave put your reconpiled xdebug.so
[xdebug]
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_port=9002 # the port you have found free and set in netbeans above
xdebug.remote_host=127.0.0.1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/tmp/"
xdebug.idekey="netbeans-xdebug"
xdebug.remote_log="/home/#user_name#/xdebug.log" #your user name
5. sudo service apache2 restart
after do this I can debug php again.
I had the same issue and I have tried many solution i had found out there but the issue still occured. I have tried to follow the step discribe in enter link description here
and
enter link description here
And that , whttp://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebughen i debug my project, my netbeats still waiting connection till i have to had the following "?XDEBUG_SESSION_START=netbeans-xdebug" in my url as http://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebug
so netbeans was able to connect with xdebug
**On Windows 10 with Netbeans 8.0 running Netbeans built in webserver **
The following options in the php.ini file resolved the issue for me:
zend_extension ='C:\path to php installation\ext\php_xdebug-2.5.0-5.6-vc11.dll'
xdebug.remote_enable=on
This issue for me seemed to be resolved by using the full path to the .dll file. Also, because I had spaces in the path name I had to enclose the path in quotes (double vs single did not seem to matter). Also, I had to set the xdebug.remote_enable option. Once I set both options, I was able to select the Debug Application option within Netbeans and the debugger started.
i was facing a similar problem, in my case i had recently update my php version and the xdebug configuration were in the only php5 folder. had simply had to copy the old xdebug configuration to the new php.ini file of the new version and it worked like before.
some of the tips to debug this are:
first check if xdebug is install, run (php -v) if xdebug details aren't there then install and add the configuration.
open phpinfo() under xdebug category check if xdebug configuration is loaded.Check for the following settings.
remote_enable = on,remote_handler=dbgp
I faced the same issue to get xdebug worked in virtualbox ubuntu machine with Netbeans.
PHP version 7.4
Changed following file
"/etc/php/7.4/apache2/conf.d/20-xdebug.ini"
and added following lines
zend_extension="/usr/lib/php/20190902/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log = "/var/log/xdebug.log"
Plese note that the line below consists double quotes for defining the path.
zend_extension="/usr/lib/php/20190902/xdebug.so"
Had same issue:
$ netstat | grep 9000
...
tcp6 1 0 localhost:9000 localhost:37486 CLOSE_WAIT
Solution: Restart NetBeans.
There was running a dead Process waiting for connections.
Here Netbeans with a running debug session. Note the CLOSE_WAIT and TIME_WAIT.
tcp6 0 0 localhost:9000 localhost:38166 TIME_WAIT
For Xdebug v>=3
If you are still facing issues after trying all above answers. And you have Xdebug version >=3 then only try my steps.
Some settings have been changed in v3.
Xdebug's default debugging port has changed from 9000 to 9003. So change it in php.ini and netbeans IDE.
In php.ini
add xdebug.start_with_request="yes"
add xdebug.client_host = localhost . (The old xdebug.remote_host=localhost is no longer useful in v3)
add xdebug.mode=debug
I use PHPStorm along with Xdebug to step through my code. PHPStorm is running on a Windows 7 machine, and my local webserver is running on a separate CentOS 6.4 machine. I've done a phpinfo(); to verify that Xdebug is being loaded by PHP, and it is. The following are the settings for my Xdebug in the PHP.ini:
[xdebug]
zend_extension="/usr/lib/php/modules/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = "192.168.1.130"
xdebug.remote_log = "/var/log/httpd/xdebug_log"
I similarly setup PHPStorm to use my CentOS server as the debugging server, and I listen for connections. I assigned static IPs to both of these machines. Using a Chrome Xdebug plugin to set the appropriate cookies, I attempt to set a breakpoint, but nothing happens. When I go to look in /var/log/httpd/xdebug_log (which has 777 permissions), nothing is written there. I've opened up port 9000, and I can telnet from my CentOS machine back to my Windows machine on port 9000 no problem. I also set SELinux to permissive, but to no avail.
Any ideas what could be happening here?
Try to configure your project in PhpStorm
Open Settings->Languages & Frameworks->PHP->Debug
Uncheck the "Ignore external connections through unregistered server configurations" option
OK
Add to your php.ini:
xdebug.mode=debug
I was having the same issue, below are the steps I performed to resolve it:
Make sure you have xdebug installed and in php.ini uncomment xdebug.mode=debug
Open Settings->Languages & Frameworks->PHP->Debug, Assign Debug Port value, you can find this port from php.ini. In my case, it was 9002
Now Validate debugger configurations - here you need to add the path to your web application files and URL. Click validate.
Now Start Listening -> Enable listening for PHP Debug Connection.
After this setup you can set a break point and start debugging with XDEBUG.
In my case, i added folder that im debugging to exclusive, so it return 502 or blank page when i put breakpoint. Remove exclusive folder and everything working.
You can consider this blog to find more solution: Link.
sudo gedit /etc/php/7.2/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9898
xdebug.idekey = “PHPSTORM”
xdebug.show_error_trace = 1
xdebug.remote_autostart = 0
xdebug.mode=debug
xdebug.client_port=9898
I installed Xdebug and all was fine, until suddenly it stopped working. phpinfo() gives a nice XDebug output with all variables.
php -m | grep deb
also gives twice XDebug (for Zend and PHP), so again looks just fine. My php.ini has these lines:
zend_extension=/usr/lib/php5/20090626/xdebug.so
;extension=xdebug.so
xdebug.remote_host=localhost
xdebug.remote_enable=on
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=1
And yet, when running this code with should check XDebug (from Netbeans docs) it's just stuck. So No IDE is working with XDebug.
<?php
$address = '127.0.0.1';
$port = 9001;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $port) or die('Unable to bind');
socket_listen($sock);
$client = socket_accept($sock);
echo "connection established: $client";
socket_close($client);
socket_close($sock);
Also, according to XDebug installation, I went twice throught the steps. What is wrong with my config? Thanks.
At the end, left with only two solutions - to reinstall the Ubuntu OS or to install a new VM especially for xdebug, I'm going for the second one.
Funny thing is, everything was working according to the "RTM" (f=freaking). One thing that I couldn't figure out is how to read the logs for XDebug in order to understand where the real problem is.
UPDATE
After some struggling, I deleted every single line related to xdebug from every php.ini that I had. And moved these lines to /etc/php5/conf.d/xdebug.ini. Restarted Apache, and then PHPStorm, and it works.
P.S. in the middle, I tried to install xdebug with pecl, from github, and the standard Ubuntu version. I think the one that I compiled is currently working. And.. the log gets updated as well.
;xdebug configuration
zend_extension = /usr/lib/php5/20090626/xdebug.so
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log="/tmp/xdebug.log"
On your server, try this command:
$ netstat -anp | grep CLOSE_WAIT
Any :9000 entries will give you XDebug troubles; consider kill -9 <pid>.
I had this problem too on Ubuntu after updating php. For me, turning on html errors in php.ini got xdebug with Netbeans to work again ...
sudo vi /etc/php5/apache2/php.ini
display_errors = On
html_errors = On
And restart apache:
sudo /etc/init.d/apache2 restart
http://ubuntuforums.org/showpost.php?p=9592364&postcount=14
I checked my
netstat -anp
output and found out that there were number of open sockets (in XDebug port range) by master process on my remote machine [running xDebug].
Killing the 'master' process solved the problem for me.
Seemed like a port overrun situation for me.
Thought the information might be useful to some.
check port is not occupied, check netbeans is configured to listen to that port(i see you have 9001, 9000 is default usually)also when i debug with eclipse i have to "terminate and relaunch" the debug session every now and then since it stops working, never under stood why, i suspect some sort of expired debug session
Check are you putting breakpoints to the right file. Find first file where script enters (front controller). On symfony there can be more than one for example.
In my case after update xdebug to 3 version I just put/set php.ini config
error_reporting=E_ALL
display_startup_errors=1
display_errors=1
and then command php -v show all warnings and errors.
In my case:
Xdebug: [Config] The setting 'xdebug.remote_enable' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_enable (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
I've been trying to configure xdebug to work along with netbeans, my current configuration is
[xdebug]
zend_extension="C:\binaries\php\ext\php_xdebug-2.1.0RC1-5.3-vc6.dll"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1 (also tried localhost)
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
I tried the test provided by a netbeans blog explaining how to test if the configuration works when binding it just outputs "unable to bind"
Any suggestions?
A couple of things off the top of my head...
Firstly, check that nothing else is already listening to port 9000 (on the command line, type netstat -an ).
If that doesn't show anything, make sure the Windows Firewall is not enabled.
This was my Solution for the same issue.
The Configuration of xdebug in the php.ini is minimalized.
php.ini:
[XDebug]
zend_extension = C:\Bitnami\wampstack-5.6.21-2\php\ext\php_xdebug.dll
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_autostart=0
xdebug.remote_connect_back=0
Right click Project > Run configuration:
Project URL: http://127.0.0.1:9000/<ProjectName>/
Index File: index.php
Tools > Options > PHP > Debugging
Debugger Port: 9001
Session ID: netbeans-xdebug
Maximum Data Length: 2048
uncheck all Checkboxes
The Debugger Port has to be another than the Server Port. The Ports defined in netbeans have to match the one defined in php.ini(xdebug-port) and httpd(apache-port)
Server: 127.0.0.1:9000
XDebug: 127.0.0.1:9001
Close netbeans and restart the server, open Netbeans and press CTRL+F5 (Run Debug).
This worked For Ubuntu 16.04, Net beans 8.2
open xdebug.ini (for me it was in /etc/php/{php-version}/mods-available) and put
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
Net beans -> Tools > Options > PHP > Debugging
Debugger Port: 9000
Session ID: netbeans-xdebug
Maximum Data Length: 2048
unchecked all Check-boxes here.
My configs were just fine as mentioned above but it wasn't working fine until i unchecked all check-boxes as mentioned by #Beka.