SlideShare a Scribd company logo
1 of 2
Download to read offline
DRUPAL DEBUGGING TIPS

==== DRUPAL DEBUGGING ====
1. Access all available variables in page.tpl.php using devel module
<?php dpm(get_defined_vars()); ?>

2. Inspect function calls
<?php dpm(debug_backtrace()); ?>
or just use
<?php ddebug_backtrace(); ?>
3.) Use the debug() just like dpm() or dsm() in devel
$label, $print_r);

- FULL OPTIONS: debug($data,

resource = http://engineeredweb.com/blog/10/6/debugging-drupal-7/
<?php debug($form); ?>

4.) Development Tools (Logging) - https://drupal.org/project/journal

5.) How to debug and troubleshoot (sitebuilders)

General advice
- Clear caches
- Check for Watchdog log messages
- Look at the source code of the web page (Firebug)
- Look at the data in the database
If a module doesn't show up on the Module List
- Check permission on the module's directory and files
- Make sure the .module file exists
- Make sure there aren't multiple copies of the .module file in sites/all/modules
If a module doesn't seem to
- Make sure you know what
- Make sure the module is
- Make sure the module is
- Make sure any necessary
- Lastly Clear the caches

be doing anything
the module is supposed to do
installed (exists in sites/all/modules)
enabled in the Module List
sub-modules are enabled

If a module doesn't seem to be doing the right thing
- Make sure you have the right version of the module
If content isn't showing up or you're denied access to it
- Check permissions
- Rebuild the node access table:
administer > content management > post settings
D7 - /admin/reports/status/rebuild
If content isn't updating after you changed something
- Clear caches

Adolfo G. Nasol

http://cavhost.com

09195951276
DRUPAL DEBUGGING TIPS

References:
-

http://drupal.org/node/199
http://www.juliakm.com/drupal-permissions-issues-debugging-checklist
http://drupal.stackexchange.com/questions/545/how-do-i-debug-drupal
http://heydon.com.au/node/1045

6.) How to debug and troubleshoot (module developers)
General advice
- Check for PHP errors
- Print some debugging information
* drupal_set_message
* watchdog
* print
* print_r
* php.net/trigger_error
* http://api.drupal.org/api/drupal/includes--common.inc/function/debug/7
- Print a backtrace
* devel module -- drush vset devel_error_handler 2
* http://www.lullabot.com/articles/quick-and-dirty-debugging
* http://www.lullabot.com/articles/quick-and-dirty-debugging#comment-4851
If a module doesn't seem to be doing anything
- Make sure all hook functions have the right name (<module name>_<hook name>)
- Context > Debug reaction
If you are having problem with Javascript
- Use alert() or console.log()
References
- http://realize.be/installing-xhprof-mac-homebrew
- SimpleTest -- http://drupal.org/node/394976
- http://blog.boombatower.com/drupal-7-debug-and-simpletest-verbose
- http://drupal.org/project/coder

Adolfo G. Nasol

http://cavhost.com

09195951276

More Related Content

What's hot

Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask PresentationParag Mujumdar
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentsparkfabrik
 
Write book in markdown
Write book in markdownWrite book in markdown
Write book in markdownLarry Cai
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupalsparkfabrik
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLarry Cai
 
Beginners PHP Tutorial
Beginners PHP TutorialBeginners PHP Tutorial
Beginners PHP Tutorialalexjones89
 
Wordpress development: A Modern Approach
Wordpress development:  A Modern ApproachWordpress development:  A Modern Approach
Wordpress development: A Modern ApproachAlessandro Fiore
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
Tools and Tips for Moodle Developers - #mootus16
 Tools and Tips for Moodle Developers - #mootus16 Tools and Tips for Moodle Developers - #mootus16
Tools and Tips for Moodle Developers - #mootus16Dan Poltawski
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesTikal Knowledge
 
Getting started with Catalyst and extjs
Getting started with Catalyst and extjsGetting started with Catalyst and extjs
Getting started with Catalyst and extjsPeter Edwards
 
Introduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap BuildIntroduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap BuildMartin de Keijzer
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 

What's hot (20)

Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask Presentation
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
 
Flask
FlaskFlask
Flask
 
Write book in markdown
Write book in markdownWrite book in markdown
Write book in markdown
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupal
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutes
 
Django
DjangoDjango
Django
 
Beginners PHP Tutorial
Beginners PHP TutorialBeginners PHP Tutorial
Beginners PHP Tutorial
 
Wordpress development: A Modern Approach
Wordpress development:  A Modern ApproachWordpress development:  A Modern Approach
Wordpress development: A Modern Approach
 
Drupal Development Tips
Drupal Development TipsDrupal Development Tips
Drupal Development Tips
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Django Documentation
Django DocumentationDjango Documentation
Django Documentation
 
Xmla4js
Xmla4jsXmla4js
Xmla4js
 
Tools and Tips for Moodle Developers - #mootus16
 Tools and Tips for Moodle Developers - #mootus16 Tools and Tips for Moodle Developers - #mootus16
Tools and Tips for Moodle Developers - #mootus16
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
Php ppt
Php pptPhp ppt
Php ppt
 
Getting started with Catalyst and extjs
Getting started with Catalyst and extjsGetting started with Catalyst and extjs
Getting started with Catalyst and extjs
 
Introduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap BuildIntroduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap Build
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 

Similar to Drupal debugging tips

Making The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowMaking The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowPhilip Norton
 
Drush. Why should it be used?
Drush. Why should it be used?Drush. Why should it be used?
Drush. Why should it be used?Sergei Stryukov
 
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011camp_drupal_ua
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Dhinakaran Mani
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Mir Nazim
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90minsLarry Cai
 
Drupal Checklist for Site Builder and Web admin
Drupal Checklist for Site Builder and Web adminDrupal Checklist for Site Builder and Web admin
Drupal Checklist for Site Builder and Web adminAdolfo Nasol
 
Improving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAImproving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAJesus Manuel Olivas
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupalDay
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practicesSynapseindiappsdevelopment
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesGerald Villorente
 
Towards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev MachineTowards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev MachineKrimson
 
Using Drupal Features in B-Translator
Using Drupal Features in B-TranslatorUsing Drupal Features in B-Translator
Using Drupal Features in B-TranslatorDashamir Hoxha
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Acquia
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondNuvole
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with FeaturesNuvole
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and moreAcquia
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait fromAndrii Podanenko
 

Similar to Drupal debugging tips (20)

Making The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowMaking The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To Swallow
 
Drush. Why should it be used?
Drush. Why should it be used?Drush. Why should it be used?
Drush. Why should it be used?
 
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
Drupal Checklist for Site Builder and Web admin
Drupal Checklist for Site Builder and Web adminDrupal Checklist for Site Builder and Web admin
Drupal Checklist for Site Builder and Web admin
 
Improving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAImproving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLA
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practices
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 
Towards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev MachineTowards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev Machine
 
Using Drupal Features in B-Translator
Using Drupal Features in B-TranslatorUsing Drupal Features in B-Translator
Using Drupal Features in B-Translator
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and more
 
Oracle applications 11i dba faq
Oracle applications 11i dba faqOracle applications 11i dba faq
Oracle applications 11i dba faq
 
Pluggin creation
Pluggin creationPluggin creation
Pluggin creation
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait from
 

More from Adolfo Nasol

Mysql cheatsheet - Part 2
Mysql cheatsheet - Part 2Mysql cheatsheet - Part 2
Mysql cheatsheet - Part 2Adolfo Nasol
 
Managing drupal views in code
Managing drupal views in codeManaging drupal views in code
Managing drupal views in codeAdolfo Nasol
 
Event Registration System Part 2
Event Registration System Part 2Event Registration System Part 2
Event Registration System Part 2Adolfo Nasol
 
Events Registration System Part 1
Events Registration System Part 1Events Registration System Part 1
Events Registration System Part 1Adolfo Nasol
 
Installing mandriva linux mandriva community wiki
Installing mandriva linux   mandriva community wikiInstalling mandriva linux   mandriva community wiki
Installing mandriva linux mandriva community wikiAdolfo Nasol
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builderAdolfo Nasol
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeAdolfo Nasol
 
Creating Drupal 7 subtheme
Creating Drupal 7 subthemeCreating Drupal 7 subtheme
Creating Drupal 7 subthemeAdolfo Nasol
 
Chs nc2 reviewer - with oral questioning
Chs nc2 reviewer - with oral questioningChs nc2 reviewer - with oral questioning
Chs nc2 reviewer - with oral questioningAdolfo Nasol
 
Operating System Concepts : Reports
Operating System Concepts : ReportsOperating System Concepts : Reports
Operating System Concepts : ReportsAdolfo Nasol
 

More from Adolfo Nasol (13)

Mysql cheatsheet - Part 2
Mysql cheatsheet - Part 2Mysql cheatsheet - Part 2
Mysql cheatsheet - Part 2
 
Mysql cheatsheet
Mysql cheatsheetMysql cheatsheet
Mysql cheatsheet
 
Managing drupal views in code
Managing drupal views in codeManaging drupal views in code
Managing drupal views in code
 
Event Registration System Part 2
Event Registration System Part 2Event Registration System Part 2
Event Registration System Part 2
 
Events Registration System Part 1
Events Registration System Part 1Events Registration System Part 1
Events Registration System Part 1
 
Installing mandriva linux mandriva community wiki
Installing mandriva linux   mandriva community wikiInstalling mandriva linux   mandriva community wiki
Installing mandriva linux mandriva community wiki
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builder
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 Theme
 
Research methods
Research methodsResearch methods
Research methods
 
Personality
PersonalityPersonality
Personality
 
Creating Drupal 7 subtheme
Creating Drupal 7 subthemeCreating Drupal 7 subtheme
Creating Drupal 7 subtheme
 
Chs nc2 reviewer - with oral questioning
Chs nc2 reviewer - with oral questioningChs nc2 reviewer - with oral questioning
Chs nc2 reviewer - with oral questioning
 
Operating System Concepts : Reports
Operating System Concepts : ReportsOperating System Concepts : Reports
Operating System Concepts : Reports
 

Drupal debugging tips

  • 1. DRUPAL DEBUGGING TIPS ==== DRUPAL DEBUGGING ==== 1. Access all available variables in page.tpl.php using devel module <?php dpm(get_defined_vars()); ?> 2. Inspect function calls <?php dpm(debug_backtrace()); ?> or just use <?php ddebug_backtrace(); ?> 3.) Use the debug() just like dpm() or dsm() in devel $label, $print_r); - FULL OPTIONS: debug($data, resource = http://engineeredweb.com/blog/10/6/debugging-drupal-7/ <?php debug($form); ?> 4.) Development Tools (Logging) - https://drupal.org/project/journal 5.) How to debug and troubleshoot (sitebuilders) General advice - Clear caches - Check for Watchdog log messages - Look at the source code of the web page (Firebug) - Look at the data in the database If a module doesn't show up on the Module List - Check permission on the module's directory and files - Make sure the .module file exists - Make sure there aren't multiple copies of the .module file in sites/all/modules If a module doesn't seem to - Make sure you know what - Make sure the module is - Make sure the module is - Make sure any necessary - Lastly Clear the caches be doing anything the module is supposed to do installed (exists in sites/all/modules) enabled in the Module List sub-modules are enabled If a module doesn't seem to be doing the right thing - Make sure you have the right version of the module If content isn't showing up or you're denied access to it - Check permissions - Rebuild the node access table: administer > content management > post settings D7 - /admin/reports/status/rebuild If content isn't updating after you changed something - Clear caches Adolfo G. Nasol http://cavhost.com 09195951276
  • 2. DRUPAL DEBUGGING TIPS References: - http://drupal.org/node/199 http://www.juliakm.com/drupal-permissions-issues-debugging-checklist http://drupal.stackexchange.com/questions/545/how-do-i-debug-drupal http://heydon.com.au/node/1045 6.) How to debug and troubleshoot (module developers) General advice - Check for PHP errors - Print some debugging information * drupal_set_message * watchdog * print * print_r * php.net/trigger_error * http://api.drupal.org/api/drupal/includes--common.inc/function/debug/7 - Print a backtrace * devel module -- drush vset devel_error_handler 2 * http://www.lullabot.com/articles/quick-and-dirty-debugging * http://www.lullabot.com/articles/quick-and-dirty-debugging#comment-4851 If a module doesn't seem to be doing anything - Make sure all hook functions have the right name (<module name>_<hook name>) - Context > Debug reaction If you are having problem with Javascript - Use alert() or console.log() References - http://realize.be/installing-xhprof-mac-homebrew - SimpleTest -- http://drupal.org/node/394976 - http://blog.boombatower.com/drupal-7-debug-and-simpletest-verbose - http://drupal.org/project/coder Adolfo G. Nasol http://cavhost.com 09195951276