netbeans php - cannot get breakpoints to work - php

I have read and tried what I've found yet I cannot get it to work, it just keeps on hanging at "Waiting for connection (netbeans-xdebug)" when starting debugging.
I do have xdebug installed (I am using wamp) and I've actually managed to get breakpoints working with sublime text 2 (yea that's right!) so the problem is not with php/xdebug on my pc per se but some setting I am missing.
my php.ini for xdebug:
; XDEBUG Extension
[xdebug]
;zend_extension ="c:/wamp64/bin/php/php5.6.25/zend_ext/php_xdebug-2.4.1-5.6-vc11-x86_64.dll"
zend_extension ="c:\wamp64\bin\php\php5.6.25\ext\php_xdebug-2.5.4-5.6-vc11-x86_64.dll"
xdebug.remote_enable = 1
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.remote_hander =dbgp
xdebug.remote_mode = req
xdebug.remote_host =127.0.0.1
xdebug.remote_port = 9000
xdebug.idekey=netbeans-xdebug
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
Netbeans debugging options are set as defaults except I unchecked "stop at first line" coz I read somewhere to do so.
If you need more info on something let me know.

I've found the issue for myself (since everything else seems to be in order on my side), netbeans will not debug non root urls for some reason, and of course I dont want to open the root every time so I've made a virtual host for that specific project with a regular url (www.someurl.com) and it seems to be working fine now.
Also I am not sure every single line is needed from my php.ini xdebug settings but I've kept it so, since I am not bothered to check for redundant lines, so if you are not sure about your xdebug settings just copy the whole thing from my Q.

Related

Xdebug Client do not hit breakpoint

I try to configure Xdebug Client for Sublime Text 3 on Windows 10 (with PHP Version 7.3.0 and 2.7.0RC2 Xdebug version).
I read issues for days because the panels context were always blank, but I solved it adding "super_globals": false in Xdebug.sublime-settings.
Now the Xdebug Context show:
The problem is the breakpoint never hits. never show me the Steps options (into, over). Even, don't show the little yellow arrow on left side.
I believe that it's related to path_mapping configure, but this really confuse me.
I dont understand why I need configure path_mapping if I work only on localhost on xampp.
php.ini:
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.7.0RC2-7.3-vc15.dll"
xdebug.remote_enable = 1
xdebug.remote_host = 127.0.0.1
xdebug.report_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_connect_back = 0
xdebug.idekey = sublime.xdebug
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.remote_log = "C:\xampp\php\tmp\xdebug.log"
You might need to add xdebug.remote_autostart = 1. Per the XDebug documentation:
xdebug.remote_autostart Type: boolean, Default value: 0
Normally you need to use a specific HTTP GET/POST variable to start remote
debugging (see Remote Debugging). When this setting is set to 1,
Xdebug will always attempt to start a remote debugging session and try
to connect to a client, even if the GET/POST/COOKIE variable was not
present.
See: XDEBUG EXTENSION FOR PHP | DOCUMENTATION
Of course, restart your server after adding.
EDIT: See also Derick's answer on this StackOverflow page about using a log file to troubleshoot, if the above doesn't work.

Why does xDebug do not work with Php Storm on Ubuntu?

I have installed xdebug and tried to use it with phpstorm. But it doesn't want work correctly.
I tried to put following settings to /etc/php5/apache/php.ini and /etc/php5/mods-avaible/xdebug.ini:
zend_extension="xdebug.so"
; Debugging
xdebug.remote_enable= 1
xdebug.remote_port= 9000
xdebug.idekey = "PHPSTORM"
; Var-Display
xdebug.var_display_max_children = 2048
xdebug.var_display_max_data = 8192
xdebug.var_display_max_depth = 99
xdebug.max_nesting_level = 3000
I thought the `xdebug.ini should be the correct place for this settings.
Then I restarted apache with sudo service apache2 restart and opened a page where I print out phpinfo(). But as you can see on screenshot - it says all the time netbeans-xdebug.
What can I do? I searched my whole system for other php.ini files, but there aren't any other files.
This is what works for me.
zend_extension="/usr/lib/php5/20121212/xdebug.so"
[xdebug]
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.show_local_vars=0
xdebug.max_nesting_level = 500
But run following command first to locate xdebug.so
locate xdebug.so
and change following line accordingly
zend_extension="/usr/lib/php5/20121212/xdebug.so"
Solution to my problem.
I figured out that in my browser, even after restarting my system (obviously) a cookie XDEBUG_SESSION=netbeans-xdebug was causing this problem.
After deleting it and reloading my phpinfo() page, my new idekey is PHPSTORM and now xdebug works with my ide.
I think the problem was that I installed xdebug and tried it with my ide without setting it up - so (default?) value for idekey was this netbeans-xdebug value. And as soon as the cookie is set, it will ignore php settings as long as this cookie is alive.
It usually happens (if the path to xdebug.so is correct) because the remote_enable is set to off.
xdebug.remote_enable=on
might solve the issue.

Debug Project in PhpStorm

I have been searching for a satisfactory answer on the net and StackOverflow without success. How should I debug Magento as a whole application — not a single file — using the PhpStorm IDE? You can do this in Visual Studio, Netbeans, and IntelliJ IDEA but I need to know how to debug an application, such as Magento, using PhpStorm.
When I try to run the debugger on a controller, such as C:\xampp\htdocs\coinandbuillion\app\code\core\Mage\Checkout\controllers\CartController.php, a bunch of errors get thrown because PhpStorm is trying to execute the file directly rather than working through the application dispatcher in index.php.
So does anyone know how to debug automatically from the initialization point of application till the end?
Here is snapshot what i got. I cant debug after that button click.
Finally I did it !!! :) Please refer steps I followed.
Install Jetbrain's chrome extension from Here.
Now follow steps as below.
In 3rd snapshot in image. your Built in server port(mine is 63342) may be different for you,I didnt change it , it was already there(default), I have just shown it. I changed other options only.
That's it !!
Edit 1:
IF you have problem writing all xdebug setting in php.ini from diagram 1, here it is text version: Don't change paths exactly like i have because you may have xampp/wamp installed on other drive, in different folder. So please add paths like zend_extension accordingly.
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "C\xampp\tmp"
xdebug.remote_port = 9000
xdebug.idekey=PHPSTORM
Ensure following :
Ensure you have Installed Chrome Extension from Here
Make sure xampp/wamp server is running.
Make sure Xdebug debugger is configured.
If not , Goto File->Settings -> search PHP and follow diagram as follows

Xdebug not stops at breakpoint in Eclipse Kepler

I asked this question before but not in detail enough.
My problem is, I use Eclipse Kepler with the PDT Plugin from this site:
Kepler - http://download.eclipse.org/releases/kepler
And I use XAMPP 1.8.3.
The problem is, my XDebug not stopping at breakpoints.
My settings are as follow:
php.ini
[XDebug]
zend_extension = "C:\dev\xampp\php\ext\php_xdebug.dll"
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
;xdebug.profiler_output_dir = "C:\development\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_cookie_expire_time = 25920000
;xdebug.trace_output_dir = "C:\development\xampp\tmp"
In Eclipse I have:
If I check "Break at first line" it stops. But if I call a page, like index.php it do not stop although I set breakpoints in this file.
Is it possible to use Xdebug in Eclipse Kepler?
EDIT
I set the xdebug.remote_log property into php.ini.
By start debugging idekey is set correctly in the logs:
idekey="ECLIPSE_DBGP"
Now, if I call a page in my webapp like feedback.php the idekey is suddenly:
idekey="netbeans-xdebug"
I think this could be the problem. But how can I change the Ide key eclipse send?
EDIT 2
I realized too, that xdebug only not works in external browser. In eclipse internal browser I am able to debug.
Oh man :-)
I cannot believe what my mistake was.
I installed the firefox extension "the easiest xdebug" and it has value "netbeans-xdebug" in the configs.
Simply deactivated the extension and now it works. :-)

Getting xDebug listed on WampServser Debug Menu

OK, been banging my head against the wall again for a few days. Trying to follow a suggestion from another answer on SO here: https://stackoverflow.com/questions/11955822/php-file-caching-vs-cache-through-htaccess . In trying to set up a local test environment with xDebug, I downloaded WampServer because it said that it was a complete package that came with xDebug included. I have tried various settings in PHP.ini, but cannot get xDebug to appear on the Debug menu of WampServer. I saw an image of a Wamp menu that had it listed in the Debug menu, along with WebGrind that I do have, but cannot accomplish the same feat.
Here are my current PHP.ini settings for xDebug (that includes a few rem'd out):
; XDEBUG Extension
;zend_extension = "c:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll"
zend_extension = c:\wamp\bin\php\php5.3.13\ext\php_xdebug-2.2.1-5.3-vc9.dll
[xdebug]
xdebug.default_enable = On ;added
xdebug.remote_enable = On ;Off
xdebug.remote_port = 9000 ;added
xdebug.remote_handler="dbgp" ;added
xdebug.remote_host="localhost" ;added
xdebug.profiler_enable = On
xdebug.profiler_enable_trigger = On ;Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.trace_output_dir = "c:/wamp/tmp" ;added
;xdebug.show_local_vars=On
;xdebug.dump.SERVER=HTTP_HOST, SERVER_NAME
;xdebug.dump_globals=On
;xdebug.collect_params=4
;xdebug.show_local_vars=1
Yes, I am aware that there are two separate PHP.ini files in Wamp, but making the change in both does nothing.
I have tried the "custom installation" instructions on the xDebug website, but that does not do anything.
phpinfo file lists it as being installed.
I can find the xDebug client in the Wamp tool's folder and open it, but the open file option on the xDebug menu is grayed out and does not work.
I have explored and tried various solutions found here on the SO website, but still no joy.
I even found a nice step by step installation webpage for WampServer and xDebug here http://www3.ntu.edu.sg/home/ehchua/programming/howto/WampServer_HowTo.html, but all I succeeded in doing was downloading another very large program called eclipse, installing and configuring that, but still nothing. This does appear to be a nice looking program, but after doing the configuration, it does not seem to associate with wampserer either.
xDebug and wampserver do appear to be very common issues asked here on SO...so any ideas that actually work???
BTW: is there any way of increasing the font size in this question and comments box here on SO, so I do not have to use a magnifying glass to see what I am typing??? I know that it is repeated down below but it is a lot easier to see what you are typing, where you are typing...just my two cents...
Thanks for any assistance,
Stan...
Try Following these Steps
Open your Wamp Server phpinfo() page.
Copy Evrything in it Using a Big Control+A and the Paste it in the xDebug Wizard. Here is the link
http://xdebug.org/wizard.php
Now Download the DLL file provided by the Wizard and put it in your wamp/bin/php/php/ext folder.
Paste the Following Code in your php.ini file at the very end...
NOTE: use php.ini under wamp/bin/apache/apache/bin/php.ini
zend_extension="C:/Softwares/wamp/bin/php/php5.3.8/ext/php_xdebug-2.2.0-5.3-vc9.dll"
[xdebug]
xdebug.remote_enable=on
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
Hope this works fine for you. I got this information after working 3 to 4 days to get xDebug on NetBeans. :)
Remove the "" from *zend_extension*
Remove ; infront of zend_extension
And finally use this code in PHP.ini both files.
[xdebug]
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.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
To work with xdebugclient, you need to add XDEBUG_SESSION_START=session_name as a parameter to the URL, where session_name is the name of your debug session.

Categories