Drupal debugging tips

4,915 views

Published on

0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,915
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
21
Comments
0
Likes
9
Embeds 0
No embeds

No notes for slide

Drupal debugging tips

  1. 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. 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

×