drupal 101: tips and tricks for troubleshooting drupal
TRANSCRIPT
![Page 1: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/1.jpg)
Troubleshooting DrupalWhen it hits the fan!
http://bit.ly/drupaltips
![Page 2: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/2.jpg)
Who are we?→ Lanette Miller & Ally Gonthier→ Support Goddesses of Acquia
![Page 3: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/3.jpg)
What is this about?
![Page 4: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/4.jpg)
The Basics All Contacts and AddressesIP Addresses and SSH PasswordsConnectionsBackupsGit (Version Control)
![Page 5: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/5.jpg)
Know Your Stack
![Page 6: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/6.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/7.jpg)
![Page 8: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/8.jpg)
What is the Problem?
Take a deep breath…
![Page 9: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/9.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/10.jpg)
Where did the Signal Flow Break?
![Page 11: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/11.jpg)
Bypass DNS with etc/hosts
![Page 12: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/12.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/13.jpg)
Chrome Dev Tools
![Page 14: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/14.jpg)
Views – show SQL→ Show SQL queries
![Page 15: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/15.jpg)
Devel Module – dpm()
![Page 16: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/17.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/18.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/19.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/20.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/21.jpg)
Simulate a page loaddrush -dv ev 'menu_execute_active_handler()'
![Page 22: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/22.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/23.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/24.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/25.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/26.jpg)
curl –SLIXGET http://sitename.com
![Page 27: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/27.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/28.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/29.jpg)
Count of all http access codesawk '{print $9}' access.log | sort | uniq -c | sort
![Page 30: Drupal 101: Tips and Tricks for Troubleshooting Drupal](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/30.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/31.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/32.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/33.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022062316/58f075861a28abbe2c8b457b/html5/thumbnails/34.jpg)
Thanks!
http://bit.ly/drupaltips