XDebug not working with xampp - php

I'm using (or trying to anyway) use the bundled XDebug with XAMPP 1.7.2. It comes bundled with Apache 2.2.12, PHP 5.3.0, XDebug 2.0.5 and Zend (not sure on version)
This is a totally fresh install of XAMPP, the only thing I've added to php.ini (at xampp/php/php.ini) is:
zend_extension_ts = "C:\xampp\php\extensions\php_xdebug.dll"
[xdebug]
xdebug.auto_trace = 1
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.collect_return = 1
xdebug.default_enable = 1
xdebug.extended_info = 1
xdebug.show_local_vars = 0
xdebug.show_mem_delta = 1
xdebug.trace_format = 1
xdebug.trace_options = 0
xdebug.trace_output_dir ="C:\xampp\tmp"
xdebug.remote_enable=1
xdebug.remote_mode="req"
xdebug.remote_host=127.0.0.1
xdebug.remote_port=17869
xdebug.idekey=<idekey>
xdebug.remote_handler="gdb"
xdebug.auto_profile = 1
xdebug.auto_profile_mode = 2
xdebug.output_dir = "C:\xampp\tmp"
xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD
(this is only one of many different configs I've tried)
But try as I might, XDebug just will not connect to anything. I've tried Netbeans and Debugclient.exe (in xampp/php/debugclient.exe). They both just sit and wait forever.
How do I get XDebug to work?

My case was quite annoying. Everything was right except for one unexpected thing. The config line
zend_extension = \xampp\php\ext\php_xdebug-2.2.5-5.5-vc11.dll
generated by the XDebug website is wrong. I had to change to
zend_extension = php_xdebug-2.2.5-5.5-vc11.dll
Hope it may save some time if anyone has the same problem as me in the future

If you havent solved this issue. Just in case and for anyone looking for an answer. Go to localhost (if your using XAMPP that is) and click on the left menu's link phpinfo(). Then click anywhere on the table and press "Ctrl + C'. Then go to http://xdebug.org/find-binary.php and paste all the info that you just copied from the table in the white text-box. Click the link below and youll have the right fil to download plus some instructions. Copy that file that you just downloaded into the location stated in the instructions (ie. C:\xampp\php\ext - in my case im using XAMPP 1.7.7). Go to your php.ini file that should hopefully be in 'C:\xampp\php\php.ini' and look for the kay-word '[XDebug]'. No copy the line 'zend_extension = C:\xampp\php\ext\php_xdebug-2.1.3-5.3-vc9.dll' (in my case) under the ';zend_extension = "C:\xampp\php\ext\php_xdebug.dll"' line. Note: make sure you dont put the ';' at the beginning of the new line that you just pasted. Now go ahead and uncomment all the 'exdebug.FUNCTION_NAME' lines that are at the bottom of each block of text.
Restart you server. Go back to your phpinfo() page, copy the table as you did before and paste it in the xDebug website. This should be enough for you to get it working.
PD: make sure that the file that you download from xDebug is approximately 147kb as there has been some instances where people download small files (ei. 3kb).
Let me know how it goes. :)

Xdebug v2.0 shouldn't work with PHP 5.3.
Xdebug v2.1 provides PHP 5.3 support. Otherwise I would get rid of the xdebug ini config except:
zend_extension_ts = "C:\xampp\php\extensions\php_xdebug.dll"
xdebug.remote_enable = On
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.remote_handler = "dbgp"
use this as your test and once this works then add additional configs. Make sure you comment out other zend stuff.

The joomla web site has a great tutorial on getting XAMPP, XDebug, and Eclipse (Netbeans is configured in the same fashion) working together and they cover all major operating systems.
http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development

I have faced such a type of problem where i configured as xdebug said for the xampp 1.7.2. Couldn't work. I just changed the zend_extension_ts to zend_extension. it works for me.

Related

Xdebug profiling not save logs to the folder

I am on windows 10 OS.
I want to use profiling , I have done some steps which articles says those are enough for Xdebug can save logs but no use I can not find any log in the mentioned folder.
I want to share my configuration with you . Please guide me even google not helped me related this.
Added lines on php.ini
[XDebug]
xdebug.mode = profile;
xdebug.start_with_request = yes;
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "C:\db\xdebug"
xdebug.profiler_output_name = "callgrind.out.%t-%s"
php.ini
alt text
I have enabled the downloaded extension on Extension section.
Even https://xdebug.org/wizard says the installation done.
Do you have any idea what is problem?
I already solved the problem.
Xdebug 3 has some changes. After reviewing of the changelog, this change needs to be made:
from
xdebug.profiler_output_dir="D:\Soft\laragon\www\xdebug"
to xdebug.output_dir="D:\Soft\laragon\www\xdebug"
You can review all changes via this link.

wamp - xdebug configuration is not getting saved

This is my xdebug configuration in my php.ini
[xdebug]
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
xdebug.remote_log = C:\wamp64\logs\xdebug.log
xdebug.idekey = PHPSTORM
xdebug.remote_port = 9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart = on
xdebug.remote_start = on
xdebug.remote_enable = on
xdebug.remote_connect_back = on
it is at the very bottom of the file.
As you can see, I have set the xdebug.idekey to PHPSTORM, but phpinfo() shows that the value is not set, what am I doing wrong?
I also set the idekey through PhpStorm, but why is there no value entry in phpinfo() at the bottom? The top one is filled ?!
EDIT from comments and #Black's answer this is the answer :
WAMP use 3 PHP.ini files :
Apache's file : wamp\bin\apache\apache[version]\bin\php.ini
PHP's file : wamp\bin\php\php[version]\php.ini
Third file : wamp\bin\php\php[version]\phpForApache.ini
First two files are usefull, apache's file is used for HTTP calls, PHP's one for CGI/CLI. The third one is used when your WAMP has 2 PHP's version, WAMP use it for saving the current config and then create a new PHP.ini file for the new version. This happens during the switch of PHP's version.
In the Xdebug's case, indeed it was the apache's file that matter. It's a common issue when the phpinfo don't show any modifications.
If you have the same configuration between those two files, you also can make a symlink from PHP's file to apache one. This will save a lot of headache.
UNLUCKY TRIES
Depends on your request, you may want to configure your server with differents things.
You tried to use Xdebug as remote, then your IDEKEY should be SET as environment variable named : DBGP_IDEKEY
Here's the doc :
xdebug.idekey
Type: string, Default value: complex Controls which IDE Key Xdebug
should pass on to the DBGp debugger handler. The default is based on
environment settings. First the environment setting DBGP_IDEKEY is
consulted, then USER and as last USERNAME. The default is set to the
first environment variable that is found. If none could be found the
setting has as default ''. If this setting is set, it always overrides
the environment variables.
You may be concerned by conditions that I pointed out with italic text
as linked in comment, take a look at the full documentation
I remember that WAMP use Xdebug as an Thread safe extension, you should try to
replace
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
by
zend_extension_ts="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
And check if you have download a correct version of Xdebug (Thread Safe)
Then restart wamp and see if something has changed.
EDIT : You have an issue with your PHP.ini, you're not modifying the right one. I succeeded on mine with this :
; XDEBUG Extension zend_extension = "C:\wamp\bin\php\php7.0.4\zend_ext\php_xdebug-2.4.0-7.0-vc14-x86_64.dll" ;
[xdebug]
xdebug.remote_enable=1
xdebug.idekey = "PHPSTORM"
xdebug.remote_autostart= on
xdebug.remote_connect_back= 1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "c:/wamp/tmp/"
xdebug.collect_params = On
xdebug.show_local_vars = On`
The reason why it was not saved is that on wamp you have to store your config in C:\wamp64\bin\apache\apache_VERSION\bin\php.ini instead of C:\wamp64\bin\php\php_VERSION\php.ini.
I searched my whole wamp/bin/php folder for the occurence of the string xdebug by using Notepad++, thats how I found it out.

netbeans php - cannot get breakpoints to work

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.

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

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