Tutorial on "Debugging Drupal or any PHP Application with XDebug and Eclipse PDT"

sudeoo - May 27, 2007 - 20:01

Dear Friends,

I have written a small tutorial on debugging drupal and PHP applications with Eclipse PDT and XDebug:

http://programmingbulls.com/debugging-drupal-php--xdebug-eclipse

Kindly, please find it and let me know if it is useful or any correction is required.

Thanks,
Sudeep

--------------------------------------
My site: http://dynamicbrain.net
Dynamicbrain is a religious- spiritual-mental-personal development news site where news articles related to well-being, health, spirituality, religion, self-help, yoga and personal development are regularly posted and even fetched from different web sources. It is an endeavour of "Institute of Psychology and Health".

Hey thanks for this, I was

gpk - May 27, 2007 - 22:41

Hey thanks for this, I was just thinking it is about time I installed a PHP debugger for use on my PC.

For noobs like me it would appear that XAMPP is the same as LAMPP and is available from e.g. sourceforge.net and apachefriends.org.

Fingers crossed it all installs smoothly, and thanks again

Hey GPK!

sudeoo - May 28, 2007 - 08:24

Hey Right. Xampp is same as LAMPP. X stands for platform: could be windows, linux,Mac. Therefore, Xampp becomes Lampp for linux and WAMPP for windows.

Let me know if everything goes well or I can help you in case of any problem.

--------------------------------------
My site: http://dynamicbrain.net
Dynamicbrain is a religious- spiritual-mental-personal development news site where news articles related to well-being, health, spirituality, religion, self-help, yoga and personal development are regularly posted and even fetched from different web sources. It is an endeavour of "Institute of Psychology and Health

Yet another way

Amitaibu - November 21, 2007 - 16:58

Here's how I did it with the Eclipse PDT all-in-one. I struggled with the Zend debugger, but Xdebug just does the work. Although my WAMP occasionally crashes.
Many thanks to Tao for most of the work he gave in his article!

1. Have a WAMP installed and running.
2. Install PDT
3. Get Xdebug that matches your PHP (the one installed with WAMP)
4. Place XDebug dll in WAMP_path\php\extensions.
5. There is no need to download another plugin for PDT. The XDebug is already implemented there.
6. Add these lines to the php.ini under C:\wamp\Apache2\bin\php.ini

[xdebug]
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
zend_extension_ts="C:\wamp\php\ext\php_xdebug-2.0.2-5.2.5.dll"

7. In Wamp restart all services.
8. Open Eclipse.
9. Open your project.
10. Open Debug Dialog> Server debugger = XDebug.
11. PHP Server - create a new one with the http://localhost/ as the root URL
12. Publish the server somewhere on your local disk.
13. Uncheck Auto-generate for the URL, and enter the correct URL as you would enter in your browser.
14. Debug!

btw, I had a problem of memory exhaustion, thus added in the .htaccess this line:

php_value memory_limit 64M

Hope it works for you guys, I know it can be frustrating.
---
gizra.com - where cool software developers meet geek fashion designers

Thanks for the info. There

gpk - November 23, 2007 - 11:03

Thanks for the info.

There is also quite a bit of info on this site now re. setting up a development environment - in the Handbooks section. This is a good place to start http://drupal.org/node/147786.

@Amitaibu: was any special configuration needed to get WAMP working with Drupal? It would be really useful if you could add a child page with description/instructions here http://drupal.org/node/263

:-)

gpk
----
www.alexoria.co.uk

WAMPServer 2

Amitaibu - May 19, 2008 - 18:58

Some changes with WAMPServer 2:

Let me try to save you some head banging! :P

..
4. Place XDebug DLL under C:\wamp\bin\php\php5.2.5\ext
..
6. Add these lines to the php.ini (left click on WAMP icon >> PHP >> PHP.ini)

[xdebug]
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
zend_extension_ts="C:\wamp\bin\php\php5.2.5\ext\php> php_xdebug-2.0.2-5.2.5.dll "

make sure the zend_extension_ts is directing to the DLL you downloaded, however note I wasn't able to work with this file php_xdebug-2.0.3-5.2.5.dll , so I'm still using php_xdebug-2.0.2-5.2.5.dll

..
12. No need to publish.

Good luck!

---
amitaibu.com

WAMPServer 2 and XDebug version 2.0.3

o_bridge - June 19, 2008 - 18:21

I got version 2.0.3 to work by using the following line:

zend_extension_ts="C:\wamp\bin\php\php5.2.6\ext\php_xdebug-2.0.3-5.2.5.dll"

I put version 2.0.2 (the link is http://www.xdebug.org/files/php_xdebug-2.0.2-5.2.5.dll, it's not on the web site anymore) and version 2.0.3 side by side in the extensions folder and first pointed to 2.0.2 (php_xdebug-2.0.2-5.2.5.dll) in the line above. When it was working, I changed to 2.0.3 (php_xdebug-2.0.3-5.2.5.dll).

Good luck :)

YAT (yet another tutorial)

boaz_r - March 31, 2008 - 12:43

Hi,

I've was just referred to this post. I've also written such a guide. Its more detailed and accompanied with screenshots then most other guides I've found on this topic:
http://www.rymland.org/blogs/boaz/5_mar_08/using-pdt-xdebug-for-debuggin...

Boaz.
--
PHP therapist
Linnovate

zend_extension versus zend_extension_ts

alex.k@drupal.org - June 2, 2008 - 20:10

Just be aware there are two versions of these directives - this article uses zend_extension_ts whereas on my install I need to use zend_extension - try which one works for you

If the debugger extension refuses to show up in phpinfo() output, try setting display_startup_errors = On in php.ini and restarting your webserver - then in webserver's error log you may find some messages if the extension cannot be found, is not the right one, etc. If there are no errors, it's either loading fine (and you should see it in phpinfo()), or php is expecting the other variant of zend_extension / zend_extension_ts

zend_extension vs zend_extension_ts

chOP - June 20, 2008 - 05:31

If you're using the 'debug' build of PHP, then use the "zend_extension" directive to load the xdebug.dll. If you're using a regular, non-debug build of PHP then use the "zend_extension_ts" directive to load the xdebug.dll. This is the reasoning behind the two variations on extension directives.

If you're unsure which build of PHP you have installed, you can find out by referring to the information returned by:

<?php
phpinfo
();
?>

Madness takes its toll.
Please have exact change.

Subscribing Kenny

webkenny - August 3, 2008 - 21:19

Subscribing

Kenny S.
Developer by day, entertainer by night.
www.webkenny.com

Proud member of the CommonPlaces E-Solutions team.
www.commonplaces.com

Subscribing as well

pkej - August 4, 2008 - 02:16

Paul K Egell-Johnsen

An excellent supplement to

webkenny - August 9, 2008 - 13:45

An excellent supplement to this is found here as well. I finally got Drupal to debug. Yahoo!

http://www.latenightpc.com/blog/archives/2008/05/24/a-complete-lamp-deve...

Kenny S.
Developer by day, entertainer by night.
www.webkenny.com

Proud member of the CommonPlaces E-Solutions team.
www.commonplaces.com

Debugger Ignores Breakpoints

electricmonk - August 25, 2008 - 09:21

Hi all,

I've managed to use XDebug successfully in non-Drupal PHP projects. In Drupal, when the 'break at first line' checkbox is checked, the debugger indeed breaks at the first line but then ignores any breakpoints I set. If 'break at first line' is unchecked, the debugger doesn't break at all.

I have set *.module and *.engine as PHP files.

Currently, I manage to work by manually stepping into the code until I get to the line in question, but this is very time consuming. Any ideas?

Environment:
PDT 2.0 (but I also checked using 1.0.3 and same problem occurs)
XDebug version is 2.0.3
Apache is 2.2.8
PHP 5.2.5
XAMPP environment
Windows XP Pro

Thanks

Shai

RE: Debugger Ignores Breakpoints

davidtinnes - November 18, 2008 - 22:44

I was able to get debugging working using XDebug Version 2.0.2-5.2.5 instead of 2.0.3

http://www.xdebug.org/files/php_xdebug-2.0.2-5.2.5.dll

Hope that helps
David Tinnes

I want to do debugging only

esend7881 - January 10, 2009 - 21:27

I want to do debugging only locally, even though my settings.php file points to my remote server.

How do I set up Eclipse PDT so that when I run a debug, it knows to look at my local MYSQL service for the SQL data?

Also, how do I set up XAMPP MySQL service with my .SQL data. My SQL file is about 900 MBs large (although when I gzip it, its 42 Mbs)

Thanks

Some more info on Drupal Eclipse PDT XDebug

captaindav - October 10, 2009 - 06:51

I posted on another thread but thought I should make a link here:

http://drupal.org/node/259622#comment-2108192

 
 

Drupal is a registered trademark of Dries Buytaert.