PhpStorm and Remote XDebug not working - php

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"

Related

netbeans xdebug waiting for connection despite going through all forum answers

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...!

How to use Xdebug in PhpStorm

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

Phpstorm, xdebug and vagrant still waiting for incoming connection

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.

Debug PHP with XDebug in Netbeans

I'm trying to debug PHP code with Netbeans 8 (with Java 1.8.0) on a MAMP 3.0.3 (PHP 5.5.10) server, the whole thing running on Mac OS X 10.9.2. But when I launch the debug, Netbeans shows a progress bar saying "Waiting For Connection (netbeans-xdebug)". it never stops, so I suppose it never gets a connection. And of course, the execution of my webapp never stops on my breakpoints.
Here the xdebug configuration in my php.ini:
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.5.10/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=on
xdebug.idekey="netbeans-xdebug"
xdebug.remote_log="/Applications/MAMP/logs/xdebug_remote.log"
I tried many things found on forums or even here on stackoverflow, but nothing works. Among them: change the port (in the php.ini and the debug conf in Netbeans), change the localhost to 127.0.0.1 or to my real IP, comment out the remote host, check if my timezone was set in the php.ini (it was), load my waebapp with a parameter XDEBUG_SESSION_START=netbeans-xdebug and much more.
Any idea? I'm open to any suggestion, at this point...
Double check your path mapping.
https://blogs.oracle.com/netbeansphp/entry/path_mapping_in_php_debugger
Then download a trial of PHPStorm and see how that works. If it works fine, consider switching to it. Honestly not trying to be smart, I think its a valid solution to this issue.
http://www.jetbrains.com/phpstorm/
http://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
I added a webroot and an index file in the Netbeans configuration (copying from a colleague's configuration, which is working properly), and now, it works. I won't pretend I really understand why. It seems really fragile, so I won't mess with it just for the sake of understanding...

XDebugging a website with Eclipse/PDT while PHP and the website-files are located on another server ... how?

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

Categories