I'm trying to debug php code with PHPStorm. I'm on a Mac with docker.
I configured xdebug on docker using:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_connect_back=1
xdebug.idekey = "PHPSTORM"
Then I open the listening on PHPStorm, set the cookie in the browser and then load a page setting a break point in the corresponding point.
It happens that, PHPStorm detect an incoming connection, and asks me to accept the connection.
I click on accept, the debug fills with the variables and after 1 second, the connection stops and the debugging session ends.
What am I doing wrong?
I was not able to get xdebug.remote_connect_back=1 to work for me.
Instead, you need to provide the IP address of the docker host. Since the docker 18.03 release, you can reference the host.docker.internal DNS entry from within running docker containers.
You should try the following:
Remove the xdebug.remote_connect_back=1 line. The default value is 0.
Add xdebug.remote_host=host.docker.internal
The rest of your steps sound correct.
Related
I have a trouble to use debugger in my code, it's my first time to use debugger, I don't know that I am doing it the right way or not, but it is not working for me. it always show this message in variables section...
Waiting for incoming connection with ide key '13001'
I followed this step...
1. my php.ini setting for xdebug
[Xdebug]
zend_extension="D:\XAMMPI\php\ext\php_xdebug-2.4.0-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=80 //i also try the default port (9000) here but it still not working
xdebug.idekey=PHPSTORM
2. I create the configuration setting for Debugger.
3. I apply the break point to code for testing
I am using PhpStorm 2016.1
Any help will be appreciated
UPDATE - 1
Just use my php.ini setting for xdebug
[XDebug]
zend_extension="D:\XAMMPI\php\ext\php_xdebug-2.4.0-5.6-vc11.dll" ; copied this link based on your config.
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=10000
xdebug.remote_autostart=1
xdebug.idekey=
Then install xDebug helper for chrome:
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
Then change the IDE key to phpstorm
After that, you should create a PHP Remote Debug and not PHP Web Application
Like the picture below.
On your settings. Which can be accessed using Ctrl+Alt S. Search for Debug port, and change it to 10000.
After that you should navigate to your extension in chrome and activate xDebug.
And that's it. Happy Debugging :)
Waiting for incoming connection with ide key '13001'
vs
xdebug.idekey=PHPSTORM
you need to set proper idekey in PHPStorm, and change back ports to 9000. 80 is port for apache (http server), so it will not work as you've configured.
Look here to learn where to set the idekey in ide: https://www.jetbrains.com/help/phpstorm/2016.1/run-debug-configuration-php-remote-debug.html
I've followed multiple tutorials to set up XDebug with PhpStorm but it seems like
I'm not lucky with it at all. No matter what I try, it's always stuck with
Waiting for incoming connection with ide key 'PHPSTORM'
But when I reload the page with CTRL + R I can see for a split second connected.
However, then it switches back to "Waiting.."
I've tried the XDebug Chrome Plugin and the PHPStorm XDebug Generator Bookmarks
aswell as enabling "Start listening for PHP Debug Connections" in PHPStorm.
I'm Using NginX with php5-fpm and tried tcpdump 9089.
As said, for a split second it dumps it. But then it's lost again..
Can someone please help me?
My php.ini config :
[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9089
xdebug.remote_connect_back=1
xdebug.profiler_enable=1
xdebug.profilter_output_dir="/tmp/xdebug.log"
xdebug.idekey=PHPSTORM
My PHPStorm Settings :
[
EDIT : I have NO IDEA why, but removing xdebug.remote_connect_back=1
and replacing it with xdebug.remote_host=my.ip.add.ess made it work?!
As I've read the docs I had the understanding that the first setting is for implicit requests
while the later one is for an explicit ip request..
Give the following setting a try, sounds funny but just copy past the entire block instead of typing them in (believe you me that helped a couple of colleague of mine)
xdebug.remote_host=10.0.2.2
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.show_exception_trace=0
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.max_nesting_level=200
p.s.
I assume you have the extinction file is exists in your guest machine (Virtual Machine) since you said it will stops at the breakpoint for split of sound
Also i assume your browser is sending the correct "PHPSTORM"
This is annoying me, mainly because it was working fine then all of a sudden breakpoints stopped breaking and when i checked debugger it was just waiting for incoming connection.
My vagrant machine is running on private_ip: 192.168.13.37
My xdebug.ini config is as follows:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.remote_port = 9020
These are my PHPstorm debug settings:
I have a vagrant server setup in PHPstorm which has a host of dev.website.com which points at the correct IP in windows host file, the port is 80 and the folders are mapped correctly.
I also have PHP application set up to use the explained server which a start url of / .
I have clicked start listening for PHP debug connections, then clicked the little green bug icon to start debugging. This launches the project with the following query string ?XDEBUG_SESSION_START=18359 but when I look in PHPstorm in the debug window it will say waiting for incoming connection with ide key 18359
Any ideas how to get it working again?
Edit
Added xdebug log : pastebin
Had identical problem, what helped me is setting :
xdebug.remote_autostart = 1
my other settings are:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9010
xdebug.idekey=phpstorm
xdebug.remote_autostart = 1
xdebug.remote_handler=dbgp
xdebug.remote_host=10.0.2.2
You say you have a server setup pointing to port 80? That could be the problem.
I have a vagrant server setup in PHPstorm which has a host of dev.website.com which points at the correct IP in windows host file, the port is 80 and the folders are mapped correctly.
Do you use PHP Remote Debug?
If it's the server setup from the screenshot, change the port there to 9020 or whatever you desire to use.
My First steps of checking why xDebug isn't working:
Set Break at first Line in the PHPStorm preferences
preferences->languages&frameworks->PHP->debug ( search break at first )
Enable the break at first Line feature
Still not working?
What does your phpinfo say?
Is xDebug enabled and do all the settings match?
phpinfo()
If not try this https://xdebug.org/wizard.php and check out this Tutorial
If so try
Is there maybe a firewall blocking your port?
No?
ok ->
vagrant ssh
netstat -an | grep 9000
Check if the port is listening and is not blocked by anything.
I would recommend using port 9000, had issues with others.
I recently had an issue with hhvm blocking the port.
I purged it from the system.
If everything looks fine, try to use phpstorms remote debug feature and map explicitly your index.php file of your project/s.
Also maybe try not to use numeric values as your idekey
XDEBUG_SESSION_START=18359
Most people use something like this:
XDEBUG_SESSION_START=PHPSTORM
you can add an idekey to your xdebug.so
would look like this
xdebug.idekey=PHPSTORM
Small list with xdebug parameters: https://xdebug.org/docs/basic
My current projects phpstorm config looks like this:
This is a plugin for setting the session cookie in the browser
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc
I had a problem very similar with my two hosts on remote server.
One was called dev.host.com, the other 123.host.com (which was corresponding to a temporary version number).
My problem was that dev.host.com was working perfectly fine with xdebug in phpstorm while the other host was always waiting for incoming connection.
I spent some hours to look why, but found nothing concluant by changing my xdebug parameters, my phpstorm conf, my folders permissions,... until I renamed my 123.host.com with some alphabetical characters like 'abc.host.com' and..... it started working !
So I would advise you to be careful with the name you choose for your host, I think it was not mapped correctly... Weird but solved on my side.
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.
Following situation:
Windows 7 running on my PC.
Also Eclipse with PDT and VMWare, which is my 'server'.
Within the VM I have Debian 5 running, Apache, PHP + XDebug and OpenSSH-Server.
I can connect to Debian with Putty using the IP 192.168.0.128 and Port 3128.
On my Win7-host there is no PHP available.
How can I get Eclipse to connect with XDebug on the VM?
I'm a bit lost here, 'cause I seem to lack some necessary network-basics. Could someone please give me a hint which 'combination of words' will lead me to the solution using Google, usually that's all you need Google + 'the right words' ... tunneling? remote? ... all lead me astray so far.
Thanks
Raffael
In php.ini on your Debian virtual server, XDebug should have some configuration variables set up. one of them is xdebug.remote_host. It is probably set to "localhost" right now. It needs to point back to your Win7 PC's IP address.
In php.ini (make sure you are editing the one that Apache is using, not the one that PHP CLI is using...they may or may not be the same):
xdebug.remote_enable=on
xdebug.remote_host=192.168.0.999
Where 192.168.0.999 is replaced with the PC's IP address.
You need to make sure that xdebug.remote_port and xdebug.remote_handler are set to the value that your Eclipse plugin is expecting too.
An alternative to specifying an xdebug.remote_host would be to use xdebug.remote_connect_back. I've never set that up, so I can't help you more than point you XDebug's docs.
Note that you may need other php.ini settings to set yourself up properly. I'm not an Eclipse user, so I'm not familiar with its special needs (if any). The XDebug docs or the documentation site for the Eclipse plugin you are using will probably have a basic installation and requirements guide for you.
If you are not sure which php.ini Apache is using, create a php file with phpinfo(); in it (and nothing else, other than <?php to start things out), and then access that file using your browser through the Apache server (drop it in the root directory of the web server). Look for "Loaded Configuration File"... should be near the top.
thanks for the effort.
For the archive, my configurations:
xdebug.ini:
xdebug.remote_autostart = Off
xdebug.remote_enable = On
xdebug.remote_mode=req
xdebug.remote_host=[HIP]
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_log=/var/log/apache2/xdebug_remote
xdebug.profiler_enable = 1
[HIP] you get through netstat, in my case it's the (only) SSH conncetion, b/c of putty.
php.ini:
zend_extension=[path you find in xdebug.ii]
Eclipse:
Debugger: XDebug
Server: IP of VM
That did it for me, basically.
Best
Raffael