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
Related
I want to use Xdebug for remote server on my local machine. I have started Xdebug on php-fpm container.
Here is my php-fpm\xdebug.ini file (same as workspace\xdebug.ini)
xdebug.remote_host="host.docker.internal"
xdebug.remote_connect_back=0
xdebug.remote_port=9009
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.cli_color=0
xdebug.profiler_enable=0
xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling"
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=-1
xdebug.mode=debug
xdebug.client_port=9009
xdebug.start_with_request=yes
xdebug.discover_client_host=1
In PhpStorm, I've created new server like this:
DBGp Proxy:
and Xdebug port:
I am able to run my project on browser by going http://localhost
However, I can't pass validate in PhpStorm debug configuration
Any thoughts?
I have gone through all the questions with this title, but I am still stuck here.
Here is my php.ini conf settings
[xdebug]
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.show_exception_trace=0
xdebug.idekey="xdebug"
xdebug.remote_log="/tmp/xdebug.log"
here is phpinfo()
here is PhpStorm server config
PhpStorm xdebug config
Now if I submit the request in debug mode in PhpStorm REST client, I get this error.
Waiting for incoming connection with ide key '19853'
I don't know how else to fix this.
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!!!!
i am trying to debug my php code in netbeans. the code runs perfectly but i am unable to debug it(doesn't stop at breakpoint) and the code runs normally.
i have tried every possible workaround in order to get my xdebug working and has been stuck from past few days.. anyone out there who can help me sort out this issue.
xdebug configuration in .ini file:
zend_extension = /usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=mgiplocalhost
xdebug.remote_port=9000
here mgiplocalhost is my virtual host.
i have tried with other possibilities as well like localhost and ip address but the waiting for connection still exists.
In netbeans->tools->options->debugging when i set my port as 9000 and debug it asks me to change the port since port 9000 is already in use. i have changing the port but the problem persist.
please i need help to sort it out asap. please help me out.
A bit late but thought this should have an answer! To get Xdebug working, the minimal configuration I found I needed in the php.ini file was the line to load the extension:
zend_extension=php_xdebug.dll (pointing to the downloaded dll from the Xdebug site)
And the following Xdebug settings also placed further down in the php.ini file:
[Xdebug]
xdebug.remote_autostart=On
xdebug.remote_enable=On
xdebug.idekey="netbeans-xdebug"
The Xdebug default port was 9000, and that is also what Netbeans was using (Tools -> Options... -> PHP -> Debugging.) If 9000 is in use, you could also set that in Netbeans to be 9001 and in the php.ini file add the line xdebug.remote_port=9001 with your other xdebug settings.
Then try it out after restarting the server.
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.