Upload
acquia
View
1.389
Download
0
Embed Size (px)
Citation preview
Troubleshooting DrupalWhen it hits the fan!
http://bit.ly/drupaltips
Who are we?→ Lanette Miller & Ally Gonthier→ Support Goddesses of Acquia
What is this about?
The Basics All Contacts and AddressesIP Addresses and SSH PasswordsConnectionsBackupsGit (Version Control)
Know Your Stack
More things to know!→ Logs→ Drush→ New Relic/Traceview→ Helpful Browser Extensions
User Agent Switcher Modify Headers Live HTTP Headers
What is the Problem?
Take a deep breath…
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?
Where did the Signal Flow Break?
Bypass DNS with etc/hosts
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
Chrome Dev Tools
Views – show SQL→ Show SQL queries
Devel Module – dpm()
Drush→ Learn to love drush→ Drush Commands can be modified with
--uri=www.sitename.com-v verbose-d debug-s simulate
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]
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
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
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
Simulate a page loaddrush -dv ev 'menu_execute_active_handler()'
Database problemsdrush sqlc
mysql --user=username --password=password –host=ipddress --database=dbname
UPDATE system set status=0 where name=modulename;
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;
Database problemscache_form
TRUNCATE TABLE cache_form;
TRUNCATE TABLE cache; TRUNCATE TABLE cache_block; TRUNCATE TABLE cache_bootstrap;…
Using Curl to see the headers → curl –SLIXGET http://address
S – show errorsL – follow redirectsI – headers onlyXGET – do a “get”
curl –SLIXGET http://sitename.com
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
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
Count of all http access codesawk '{print $9}' access.log | sort | uniq -c | sort
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
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
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
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
Thanks!
http://bit.ly/drupaltips