Debug Project in PhpStorm - php

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

Related

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.

PHPStrom Xdebug and Wamp - Does not detect breaking point

I can't get Xdebug work with PHPStorm2016 and Wamp. Here is some details.
I've installed PhpStorm, Xdebug on Chrome and WAMP on my local machine.
My working directory is located on WAMP in www/b2b-working/
PHP.INI
[xdebug]
zend_extension ="C:\wamp64\bin\php\php5.6.16\ext\php_xdebug-2.4.0-5.6-vc11-x86_64.dll"
xdebug.remote_enable = on
xdebug.profiler_enable = off
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
Web Server pictures
Debug Configuration and server pictures
If I'm starting to listen for PHP Debug Connections the localhost is blocked and I need to click next in the debugger to display the page
However, when I'm trying to actually have a break point on my project which is located in localhost/b2b-working it does not catch any of the breaking point. I don't know what I'm missing.
The Validate Debugger Configuration on We Server is all checked
Any help is welcome
I've found the solution. Basically, you need to edit the .htacess file with the following instructions

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.

XDebug not working with xampp

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.

Categories