Debugging Drupal<br />Setting up a local development environment<br />
Tools of the Trade<br />Web server solution stack<br />Windows: XAMPP<br />Mac: MAMP<br />Integrated development environme...
Step 1: Set up your server<br />MAMP 1.8.3<br />XAMPP 1.7.1 (older version with PHP 5.2) from Sourceforge: http://sourcefo...
Step 1: Edit PHP settings<br />Find php.ini<br />MAMP: /Applications/MAMP/conf/PHP5/php.ini<br />XAMPP: c:xamppPHPphp.ini<...
Step 1: Edit PHP settings<br />Find [xdebug] section towards the end of the file<br />Uncomment the line zend_extension=… ...
Step 1: Verify changes<br />Restart *AMP<br />Get to the php info page (via Devel module or *AMP website)<br />
Step 2: Set up Aptana<br />Download and install Aptana Studio from http://www.aptana.org/studio/download (standalone, full...
Step 2: Set up Aptana<br />Aptana Studio &gt; Preferences &gt; PHP &gt; Debug &gt; Default Settings group panel<br />Set d...
Step 2: Set up Aptana<br />Associate Drupal file extensions as PHP files<br />Preferences &gt; General &gt; Content Types<...
Step 2: Set up Aptana<br />Add the PHP debug perspective<br />
Step 3: Set up Firefox<br />Install Xdebug Helper add-on: https://addons.mozilla.org/en-US/firefox/addon/3960<br />Toggle ...
Step 3: Set up Firefox<br />Default configuration for add-on should be fine<br />
Presto!<br />Ensure Firefox is not working in offline mode<br />Toggle on the Xdebug session<br />Reload the page<br />
Printing out variables<br />From PHP:<br />var_dump( $var1[, $var2, $var3, …] );<br />var_export( $var[, $returnAsString] ...
Additional Resources<br />About Xdebug Helper Firefox add-on: http://code.google.com/p/syslogr-utils/wiki/XdebugHelper<br ...
Upcoming SlideShare
Loading in …5
×

Setting up a debugging environment for Drupal

7,708 views
7,553 views

Published on

Published in: Technology
2 Comments
6 Likes
Statistics
Notes
  • Great, easy to follow along, but can't follow after slide 11. xdebug helper seems to no longer be available. What else do people use? Is it essential to have the firefox add-on?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Very useful for debugging, I've searched for this for ages, thanks
    Suze
    http://www.3kmobile.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
7,708
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
2
Likes
6
Embeds 0
No embeds

No notes for slide

Setting up a debugging environment for Drupal

  1. 1. Debugging Drupal<br />Setting up a local development environment<br />
  2. 2. Tools of the Trade<br />Web server solution stack<br />Windows: XAMPP<br />Mac: MAMP<br />Integrated development environment (IDE)<br />Aptana<br />Web browser<br />Firefox + add-ons<br />
  3. 3. Step 1: Set up your server<br />MAMP 1.8.3<br />XAMPP 1.7.1 (older version with PHP 5.2) from Sourceforge: http://sourceforge.net/projects/xampp/files/<br />
  4. 4. Step 1: Edit PHP settings<br />Find php.ini<br />MAMP: /Applications/MAMP/conf/PHP5/php.ini<br />XAMPP: c:xamppPHPphp.ini<br />error_reporting = E_ALL<br />display_errors = On<br />display_startup_errors = on<br />log_errors = on<br />error_log = “/path/to/php_error.log”<br />
  5. 5. Step 1: Edit PHP settings<br />Find [xdebug] section towards the end of the file<br />Uncomment the line zend_extension=… by removing the semicolon<br />Add the following parameters after that line:<br />xdebug.remote_enable=1<br />xdebug.remote_handler=&quot;dbgp&quot;<br />xdebug.collect_params=3<br />xdebug.show_local_vars=On<br />xdebug.dump_globals=On<br />xdebug.show_exception_trace=On<br />xdebug.remote_mode=req<br />xdebug.idekey=default<br />Find [Zend] section<br />Comment the line zend_extension=… by prepending a semicolon<br />
  6. 6. Step 1: Verify changes<br />Restart *AMP<br />Get to the php info page (via Devel module or *AMP website)<br />
  7. 7. Step 2: Set up Aptana<br />Download and install Aptana Studio from http://www.aptana.org/studio/download (standalone, full installer)<br />Install PDT SDK 2.1.2<br />Set up your workspace<br />File &gt; New Project…<br />PHP &gt; PHP Project<br />
  8. 8. Step 2: Set up Aptana<br />Aptana Studio &gt; Preferences &gt; PHP &gt; Debug &gt; Default Settings group panel<br />Set debugger to Xdebug<br />Click Configure, ensure Xdebug is on port 9000<br />Click “PHP Executables…”, then “Add…”<br />Add a new PHP executable which points to *AMP’s php executable (/Applications/MAMP/bin/php5/bin/php, c:xamppin...) and the php.ini file (/Applications/MAMP/conf/php5/php.ini)<br />Click OK<br />Return to the group panel and verify that the PHP executable is set<br />Restart the server<br />
  9. 9. Step 2: Set up Aptana<br />Associate Drupal file extensions as PHP files<br />Preferences &gt; General &gt; Content Types<br />Within Content Types &gt; Text select PHP Content Type and add *.module and *.install<br />Preferences &gt; General &gt; Editors &gt; File Associations<br />Add *.module and *.install extension<br />Under Associated editors selected PHP editor and click Default<br />
  10. 10. Step 2: Set up Aptana<br />Add the PHP debug perspective<br />
  11. 11. Step 3: Set up Firefox<br />Install Xdebug Helper add-on: https://addons.mozilla.org/en-US/firefox/addon/3960<br />Toggle Xdebug session<br />Toggle Xdebug profiler<br />
  12. 12. Step 3: Set up Firefox<br />Default configuration for add-on should be fine<br />
  13. 13. Presto!<br />Ensure Firefox is not working in offline mode<br />Toggle on the Xdebug session<br />Reload the page<br />
  14. 14. Printing out variables<br />From PHP:<br />var_dump( $var1[, $var2, $var3, …] );<br />var_export( $var[, $returnAsString] );<br />print_r( $var[, $returnAsString] );<br />From the Devel module:<br />dprint_r()<br />Better formatting of code than print_r()<br />dsm()<br />Print into the messages box<br />“Less likely to wreck your beautiful page layout”<br />
  15. 15. Additional Resources<br />About Xdebug Helper Firefox add-on: http://code.google.com/p/syslogr-utils/wiki/XdebugHelper<br />Settings up a debugging environment in Aptana: http://docs.aptana.com/docs/index.php/Developing_with_the_Aptana_PHP_Plugin<br />Xdebug website:http://xdebug.org/<br />

×