Your SlideShare is downloading. ×
Setting up a debugging environment for Drupal
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Setting up a debugging environment for Drupal

7,304

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,304
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
2
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×