34
Troubleshooting Drupal When it hits the fan! http://bit.ly/drupaltips

Drupal 101: Tips and Tricks for Troubleshooting Drupal

  • Upload
    acquia

  • View
    1.389

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Troubleshooting DrupalWhen it hits the fan!

http://bit.ly/drupaltips

Page 2: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Who are we?→ Lanette Miller & Ally Gonthier→ Support Goddesses of Acquia

Page 3: Drupal 101: Tips and Tricks for Troubleshooting Drupal

What is this about?

Page 4: Drupal 101: Tips and Tricks for Troubleshooting Drupal

The Basics All Contacts and AddressesIP Addresses and SSH PasswordsConnectionsBackupsGit (Version Control)

Page 5: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Know Your Stack

Page 6: Drupal 101: Tips and Tricks for Troubleshooting Drupal

More things to know!→ Logs→ Drush→ New Relic/Traceview→ Helpful Browser Extensions

User Agent Switcher Modify Headers Live HTTP Headers

Page 7: Drupal 101: Tips and Tricks for Troubleshooting Drupal
Page 8: Drupal 101: Tips and Tricks for Troubleshooting Drupal

What is the Problem?

Take a deep breath…

Page 9: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Questions to ask→ What do you see? → What do you expect to see?→ When did it start?→ What has changed?→ Is it reproducible?→ Logged in versus anonymous users?

Page 10: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Where did the Signal Flow Break?

Page 11: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Bypass DNS with etc/hosts

Page 12: Drupal 101: Tips and Tricks for Troubleshooting Drupal

etc/hosts### Host Database###127.0.0.1 localhost255.255.255.255 broadcasthost::1 localhost##change below here127.0.0.1 d8b12.dd127.0.0.1 eelmiller.dev.dd127.0.0.1 eelmiller.test.dd127.0.0.1 broad.test.dd127.0.0.1 d8test2.dd127.0.0.1 d8.dd23.23.23.24 myserver.com

Page 13: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Chrome Dev Tools

Page 14: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Views – show SQL→ Show SQL queries

Page 15: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Devel Module – dpm()

Page 16: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Drush→ Learn to love drush→ Drush Commands can be modified with

--uri=www.sitename.com-v verbose-d debug-s simulate

Page 17: Drupal 101: Tips and Tricks for Troubleshooting Drupal

One time login link→ For User 1 / Admin User

drush uli --uri=www.sitename.com

→ For any other userdrush uli –uri=www.sitename.com --name=usernamedrush uli –uri=www.sitename.com --uid=55drush uli –uri=www.sitename.com [email protected]

Page 18: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Working with Users→ Create a User

drush ucrt username [email protected] --password=“1234”

→ Change a passworddrush upwd username –password=“newpass”

→ Assign a role to a userdrush urol “administrator” --name=username

Page 19: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Working with Modules and Themes→ Enable module

drush en modulename→ Disable module

drush dis module→ Enable theme and set as default

drush en themenamedrush vset theme_default themename

Page 20: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Rebuilding the Registry

https://www.drupal.org/project/registry_rebuilddrush rrdrush php-eval “registry_rebuild();”

PHP Fatal error: Class 'EntityAPIControllerExportable' not found in ...sites/all/modules/rules/includes/rules.core.inc on line 11

Page 21: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Simulate a page loaddrush -dv ev 'menu_execute_active_handler()'

Page 22: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Database problemsdrush sqlc

mysql --user=username --password=password –host=ipddress --database=dbname

UPDATE system set status=0 where name=modulename;

Page 23: Drupal 101: Tips and Tricks for Troubleshooting Drupal

SELECT table_name AS "Tables", round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" FROM information_schema.TABLES ORDER BY (data_length + index_length) DESC;

Page 24: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Database problemscache_form

TRUNCATE TABLE cache_form;

TRUNCATE TABLE cache; TRUNCATE TABLE cache_block; TRUNCATE TABLE cache_bootstrap;…

Page 25: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Using Curl to see the headers → curl –SLIXGET http://address

S – show errorsL – follow redirectsI – headers onlyXGET – do a “get”

Page 26: Drupal 101: Tips and Tricks for Troubleshooting Drupal

curl –SLIXGET http://sitename.com

Page 27: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Memory Problems→ Memory Profiler module

https://www.drupal.org/project/memory_profiler

→ Conditional memory overrideshttps://docs.acquia.com/articles/conditionally-increasing-memory-limits

→ “unable to allocate memory for pool” APC or Zend OpCache

Page 28: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Log Magic→ grep

grep –i “string to look for” filename.loggrep –ic “string to look for” filename.log

→ zgrep for compressed log fileszgrep –i “string to look for” filename.log.gz

→ cat and zcat

Page 29: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Count of all http access codesawk '{print $9}' access.log | sort | uniq -c | sort

Page 30: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Top urls for an access codecat access.log | awk '{ if ($9 == 404) print $7 }' | sort | uniq -c | sort -rn | head -n 20Replace 404 with error code

Page 31: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Top IP addresses for error code with URLcat access.log| grep '" 404'|awk '{print $1 $7}'| sort| uniq -c| sort -nr| head

Replace 404 with error code

Page 32: Drupal 101: Tips and Tricks for Troubleshooting Drupal

cat access.log | awk '{if ($4 ~ /2015:14/) print $1 }' | sort | uniq -c | sort -nr | head -20Replace “2015:14” with current year and hour

Top IP address for an hour

Page 33: Drupal 101: Tips and Tricks for Troubleshooting Drupal

URL’s visited by an IP addresscat access.log | awk '{ if ($1 == ”xxx.xx.xx.xx") print $7 }' | sort | uniq -c | sort -nr | head -20Replace “xxx.xx.xx.xx” with ip address

Page 34: Drupal 101: Tips and Tricks for Troubleshooting Drupal

Thanks!

http://bit.ly/drupaltips