Forensic Drupal Debugging Dan Harris daneesia on drupal.org.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

ADABAS to RDBMS UsingNatQuery. The following session will provide a high-level overview of NatQuerys ability to automatically extract ADABAS data from.
Extending JIRA Rachel Wright July 15, 2014 See slide “Notes” section for commentary and talking points.
Service Manager Service Desk Overview
Seattle Drupal Clinic Introduction to Drupal and Web Content Management.
BEST PRACTICES FOR MAGENTO DEBUGGING ERIK HANSEN | CO-FOUNDER AND DIRECTOR OF TECHNOLOGY AT CLASSY LLAMA STUDIOS.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
Server-Side vs. Client-Side Scripting Languages
Chapter Apache Installation in Linux- Mandrake. Acknowledgment The following information has been obtained directly from
Multiple Tiers in Action
Analysis and Performance Information Systems 337 Prof. Harry Plantinga.
Website Development with PHP and MySQL Introduction.
UWWD In our quest to eliminate bad websites, we present…. HALLELUJAH!!
The easy way to a nice looking website design By a total non-designer (Me!)
APACHE SERVER By Innovationframes.com »
Build a CMS Website. The topics this chapter covers are: What is CMS ? What you can do with CMS The benefits and disadvantages of using a content management.
The Dr ü G Book: An Intro to Drupal The Dr ü G Book: An Intro to Drupal (Dr ü G: Drupal User ’ s Group - users, not developers) This is an introduction.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
© 2009 GroundWork Open Source, Inc. PROPRIETARY INFORMATION: Information contained herein is not for use or disclosure outside of GroundWork Open Source,
Justin Klein Keane Drupal Training Session 1 Introduction to Drupal.
Drupal Workshop Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology, Drupal technology, directories.
Drupal 7 as an enterprise web application framework Why as a developer you should use Drupal to build web applications? Klaus Harris DrupalCon Munich 2012.
Hook, Drush, and Alters Oh Mai! Bryan Ollendyke.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Installing CiviCRM onto Wordpress. How does it work?
TOP 20 MISTAKES YOU WILL MAKE IN YOUR 1ST DRUPAL PROJECT IZTOK SMOLIČ, ZAGREB.
Welcome to Drupal Crash course - Gartheeban Ganeshapillai.
SCHOOL OF INFORMATION UNIVERSITY OF MICHIGAN si.umich.edu Drupal: Configuration and Customization Week 4: Installation, Module Development January 25,
Drupal Training Syllabus Chaitanya Lakshmi
WaveMaker Visual AJAX Studio 4.0 Training Troubleshooting.
Presented by Chad Kafka This Month’s Topic: Wikispaces Advanced Today’s session is an introduction to what a WIKI is and how they can be used in education.
June 18, Agenda Welcome Updates and Reminders New CT.gov Site eGovernment Applications Questions & Comments.
Copyright© 2003 Avaya Inc. All rights reserved Upgrade to Communication Manager 2.0 with Migration to Linux 8.0 Purpose: This presentation was prepared.
INFM603 Project Presentation Jenny Wu Prachi Chhokar.
The Art of Debugging Shlomy Gantz 02/13/01MDCFUG.
® IBM Software Group © 2009 IBM Corporation Rational Publishing Engine RQM Multi Level Report Tutorial David Rennie, IBM Rational Services A/NZ
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
111 EMC CONFIDENTIAL—INTERNAL USE ONLY NMC -- NW Administration NMC Team NetWorker 7.3 TOI July 28, 2005.
Ideas to Improve SharePoint Usage 4. What are these 4 Ideas? 1. 7 Steps to check SharePoint Health 2. Avoid common Deployment Mistakes 3. Analyze SharePoint.
Revolutionizing enterprise web development Searching with Solr.
Proposal for the new group web infrastructure SFT Group meeting 3/7/2009 Yves Perrin.
What you don’t know you don’t know about Drupal 6 Dan Harris daneesia on drupal.org.
Basics of Drupal for Admins Rochelle Terman
Seattle Drupal Clinic Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology.
What’s new in Kentico CMS 5.0 Michal Neuwirth Product Manager Kentico Software.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
1 Session Number Presentation_ID © 2001, Cisco Systems, Inc. All rights reserved. Using the Cisco TAC Web Site for LAN Switching Issues Cisco TAC Web Seminar.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
WEP Presentation for non-IT Steps and roles in software development 2. Skills developed in 1 st year 3. What can do a student in 1 st internship.
Chapter 10 Chapter 10: Managing the Distributed File System, Disk Quotas, and Software Installation.
What is Web Site Administration Tool ? WAT Allow you to Configure Web Site With Simple Interface –Manage Users –Manage Roles –Manage Access Rules.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
GOSS iCM Forms Gary Ratcliffe. 2 Agenda Webinar Programme Form Groups Publish Multiple Visual Script Editor Scripted Actions Form Examples.
Introduction and Principles Web Server Scripting.
DrupalCon 2011: Feedback ENTICE meeting 8 April 2011 Silvia Tomanin DG-CO.
Unit 1 – Web Concepts Instructor: Brent Presley.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
PHP (cont.). 2 Functions Definition – function name(arguments){... } –syntax name as for a variable, but without $ arguments as for variables –to return.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
Leveraging Web Content Management in SharePoint 2013 Christina Wheeler.
Here are some things you can do while you wait 1.Open your omeka.net site in your browser (e.g. 2.Open.
IBM Software Group © 2008 IBM Corporation Tivoli Provisioning Manager Beta Program Web Replay Intro and Lab September, 2008 Robert Uthe.
How to use Drupal Awdhesh Kumar (Team Leader) Presentation Topic.
Lunch and Learn Session 3
Bulk update E. Camelback Road #559, Phoenix, AZ Phone: Fax:
Basics of Drupal for Researchers
Cookies BIS1523 – Lecture 23.
Instructor: Prasun Dewan (FB 150,
James Blankenship March , 2018
Building Web Applications
Presentation transcript:

Forensic Drupal Debugging Dan Harris daneesia on drupal.org

Agenda Basic Principles: what are the clues Basic Principles: what are the clues Drupal UI Configuration Drupal UI Configuration White Screen of Death (WSOD) White Screen of Death (WSOD) Debugging with Themer/Devel Debugging with Themer/Devel Q&A Session Q&A Session

What’s NOT Covered Javascript bugs Javascript bugs HTML/CSS bugs HTML/CSS bugs Using a tool with breakpoints to step through code execution Using a tool with breakpoints to step through code execution Performance debugging Performance debugging Anything not mentioned on the previous slide Anything not mentioned on the previous slide

Reviewing Trace Evidence Some or all of the following are part of rendering a Drupal page: Some or all of the following are part of rendering a Drupal page: –Drupal core, contributed, and custom modules/templates –HTML, CSS, and Javascript –PHP, Apache, some dB software, and the host OS –The browser and client OS –Host hardware and client hardware –Load balancers, external caching, networking equipment and protocols, etc. etc. All of them have versions All of them have versions All of them are possible culprits when something goes awry. All of them are possible culprits when something goes awry.

Reviewing Trace Evidence When something goes wrong, where do I look for clues? When something goes wrong, where do I look for clues? –Output is wrong or missing, check Input filter setting Input filter setting Template and CSS files: remember that files outside you’re theme have influence Template and CSS files: remember that files outside you’re theme have influence Permissions and configuration settings Permissions and configuration settings Use code to help you figure it out Use code to help you figure it out –Error message: Check log files (Drupal, PHP, dB) Check log files (Drupal, PHP, dB) Search the message on Drupal.org Search the message on Drupal.org –WSOD: in a few slides

Drupal 6 UI Configuration /admin/settings/error-reporting /admin/settings/error-reporting –Staging site: write errors to log and screen; –Production: write errors to the log only

Drupal 6 UI Configuration /admin/settings/performance /admin/settings/performance –Disable all caching/compression on staging (no need) –May selectively disable these when debugging on production Remember to flush caches when Remember to flush caches when –Introducing a new module/theme file –If you have caching enabled and change something like a menu

Drupal 6 UI Configuration /admin/settings/admin /admin/settings/admin –Consider using a separate theme for admin –I like Adaptivetheme for this purpose Some useful code if you use an admin module: Some useful code if you use an admin module: function YOURMODULE_init() { if ( (arg(0) == 'node' && arg(1) == 'add') || if ( (arg(0) == 'node' && arg(1) == 'add') || (arg(0) == 'node' && arg(2) == 'edit') || (arg(0) == 'node' && arg(2) == 'edit') || …) …) { if ($admin_theme = variable_get('admin_theme', 0)) { if ($admin_theme = variable_get('admin_theme', 0)) { global $custom_theme; global $custom_theme; $custom_theme = $admin_theme; $custom_theme = $admin_theme; drupal_add_css(); // Use to add custom CSS for your admin theme drupal_add_css(); // Use to add custom CSS for your admin theme } }}

Drupal Status Report and Logs /admin/reports/status & /admin/reports/dblog /admin/reports/status & /admin/reports/dblog Check these often, especially when Check these often, especially when –Site in development –First couple weeks after deployment

Gotcha when Using the Collaboration Tools Updating Drupal normally 2 steps Updating Drupal normally 2 steps –1) Update modules; 2)Run update.php It’s 3 steps for the Collab Tools It’s 3 steps for the Collab Tools –Run collab tool updater –Update modules not updated by collab tool –Run update.php Some people forget the third step! Some people forget the third step!

Debugging the WSOD A few things to try: A few things to try: –If you’re only getting it on a particular screen, check the log report and files –(Temporarily) paste the following into the top of index.php (after <?php): // Use the if for a multi-site; otherwise you just need the 3 lines if ($_SERVER['HTTP_HOST']==='some.domain.name.here') { error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);

Debugging the WSOD A few things to try: A few things to try: –Log on to the server and access the log files: tail /var/log/apache2/error.log –Check your dB & OS logs too –Additional resources:

Debugging with Themer

“Firebug for Drupal Theming” “Firebug for Drupal Theming” Theme hook called: indicates where and how you can hook into the execution. Theme hook called: indicates where and how you can hook into the execution. File used: template file used to generate this part of the page File used: template file used to generate this part of the page –Click the link to view the file Function called: click link to display API call on api.drupal.org Function called: click link to display API call on api.drupal.org Preprocess functions: functions called before the section is rendered Preprocess functions: functions called before the section is rendered –A word of caution: in a sub-theme, preprocess functions targeting the same area of execution (e.g. page) may both be run. Template variables provide valuable debug info Template variables provide valuable debug info

A word of Caution about Themer Enabling Themer can cause other bugs! Enabling Themer can cause other bugs! –Edit Content > Manage Fields: displays field weights –Edit Content > Display Fields: all messed up –Etc. Best to enable, use, then disable Best to enable, use, then disable –The Devel block provides such capability

Debugging with Devel Devel can provide the following: Devel can provide the following: –dB Query information –Highlight slow queries –Display page load times & memory usage –More information when PHP errors are generated via backtrace. –Functions to embed in your code and provide valuable debug information –Generate content!

Devel Function Calls dsm(), dpm(): print a variable out to an interactive UI dsm(), dpm(): print a variable out to an interactive UI Example: if (module_exists('devel')) dpm($node); dvm(): similar to dsm/dpm except uses var_dump() instead of print_r(). dvm(): similar to dsm/dpm except uses var_dump() instead of print_r(). dpr(): pretty print version of PHP print_r() call dpr(): pretty print version of PHP print_r() call Example: if (module_exists('devel')) dprint_r($_SESSION); dvr(): same as dpr, except uses var_dump(). dvr(): same as dpr, except uses var_dump(). dd(): write debug information out to a file dd(): write debug information out to a file Many many more: Many many more: See also See also

Problem Solving Best Practices Shamelessly stolen from Shamelessly stolen from –Keep a log of changes on the site. Note when a new module is installed a new module is installed a patch is applied a patch is applied an upgrade is done. an upgrade is done. Consider using the journal module to help with this. Consider using the journal module to help with this. journal –Keep your code under source control (Git). –Keep multiple backups of your database. Consider using the Backup and Migrate Consider using the Backup and Migrate Backup and MigrateBackup and Migrate –Try to have matching production, staging, and testing environments –Have a quick path to replicating production to another testing environment –Use a notebook to record changes when working through a complex debugging session.

Where to go from Here Join the Stanford Drupallers Group Join the Stanford Drupallers Group For hard-core debugging tips, view For hard-core debugging tips, view –One tip from the video: never copy and paste code form Skype…you have been warned –One tip from the video: never copy and paste code form Skype…you have been warned – (Randy Fay) Ask on Drupal.ogr: Ask on Drupal.ogr: –If your question is directly related to a module, place a support request in the module issue queue –If more generic, use the Forums

Q&A Session

Thanks! Feel free to contact me: Feel free to contact me: –daneesia on Drupal