Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Debugging WordPress

310 views

Published on

The slides for my presentation at WordCamp Noord-Nederland on 10/02/2018.

This presentation is an introduction to the basics of debugging WordPress related errors.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Debugging WordPress

  1. 1. D E B U G G I N G W O R D P R E S S B R E C H T RY C K A E R T
  2. 2. B R E C H T RY C K A E R T • Works at combell.com • WP user since 1.5 • Passionate about WordPress Security & Performance
 
 @brechtryckaert
 brechtryckaert.com
  3. 3. W H E N L A U N C H I N G Y O U R N E W W E B S I T E
  4. 4. O R W H E N U P D AT I N G Y O U R P L U G I N S O R T H E M E S
  5. 5. … O R E V E N M I G R AT I N G Y O U R W E B S I T E …
  6. 6. W H O ’ S E X P E R I E N C E D T H I S B E F O R E ?
  7. 7. T W O K I N D S O F 
 E R R O R C O D E S …
  8. 8. 4 0 0 - C O D E S 
 5 0 0 - C O D E S
  9. 9. 4 0 0 - C O D E S 
 5 0 0 - C O D E S You stuffed up (client errors) Your server stuffed up (server errors)
  10. 10. 400 Bad Request 401 Unauthorized (RFC 7235) 402 Payment Required 403 Forbidden 404 Not Found 405 Method Not Allowed …
  11. 11. 500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout …
  12. 12. H O W T O D E B U G ?
  13. 13. - S E R V E R L O G S 
 - W P _ D E B U G 
 - W P - C L I
  14. 14. S E R V E R L O G S
  15. 15. T Y P E S O F E R R O R S I N T H E L O G S • FATAL ERROR • WARNING/NOTICE • LIMIT-RELATED
  16. 16. [Sat Feb 10 02:05:22.490389 2018] [error] [pid 5740] mod_proxy_fcgi.c(954): (70007)The timeout specified has expired: [client 141.101.77.82:32531] AH01075: Error dispatching request to : (polling) [Sat Feb 10 03:42:55.356581 2018] [error] [pid 34419] mod_authz_core.c(873): [client 176.62.169.28:27736] AH01630: client denied by server configuration: /data/sites/web/somewebsite.com/.user.ini [Sat Feb 10 10:50:24.838424 2018] [error] [pid 41100] mod_proxy_fcgi.c(954): (70007)The timeout specified has expired: [client 162.158.111.75:24677] AH01075: Error dispatching request to : (polling) [Sat Feb 10 10:50:36.741167 2018] [error] [pid 48392] apache2_util.c(271): [client 172.68.65.254:35087] [client 172.68.65.254] ModSecurity: Access denied with code 403 (phase 2). Matched phrase "SemrushBot" at REQUEST_HEADERS:User-Agent. [file "/usr/local/httpd/conf/modsecurity-crs/activated-rules/modsecurity_crs_35_bad_robots.conf"] [line "20"] [id "990002"] [rev "2"] [msg "Request Indicates a Security Scanner Scanned the Site"] [data "mozilla/5.0 (compatible; semrushb ot/1.2~bl; +http://www.semrush.com/bot.html)"] [severity "CRITICAL"] [ver "OWASP_CRS/2.2.9"] [maturity "9"] [accuracy "9"] [tag "OWASP_CRS/AUTOMATION/SECURITY_SCANNER"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"] [h ostname “www.somewebsite.com”] [uri "/tag/romeinen/"] [unique_id "Wn7AbE4XLPnYH7fIxTBlGwAAAcY"]
  17. 17. [Sat Feb 10 02:05:22.490389 2018] [error] [pid 5740] mod_proxy_fcgi.c(954): (70007)The timeout specified has expired: [client 141.101.77.82:32531] AH01075: Error dispatching request to : (polling) [Sat Feb 10 03:42:55.356581 2018] [error] [pid 34419] mod_authz_core.c(873): [client 176.62.169.28:27736] AH01630: client denied by server configuration:/data/sites/web/somewebsite.com/.user.ini [Sat Feb 10 10:50:24.838424 2018] [error] [pid 41100] mod_proxy_fcgi.c(954): (70007)The timeout specified has expired: [client 162.158.111.75:24677] AH01075: Error dispatching request to : (polling) [Sat Feb 10 10:50:36.741167 2018] [error] [pid 48392] apache2_util.c(271): [client 172.68.65.254:35087] [client 172.68.65.254] ModSecurity: Access denied with code 403 (phase 2). Matched phrase "SemrushBot" at REQUEST_HEADERS:User-Agent. [file "/usr/local/httpd/conf/modsecurity-crs/activated-rules/modsecurity_crs_35_bad_robots.conf"] [line "20"] [id "990002"] [rev "2"] [msg "Request Indicates a Security Scanner Scanned the Site"] [data "mozilla/5.0 (compatible; semrushb ot/1.2~bl; +http://www.semrush.com/bot.html)"] [severity "CRITICAL"] [ver "OWASP_CRS/2.2.9"] [maturity "9"] [accuracy "9"] [tag "OWASP_CRS/AUTOMATION/SECURITY_SCANNER"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"] [h ostname “www.somewebsite.com”] [uri "/tag/romeinen/"] [unique_id "Wn7AbE4XLPnYH7fIxTBlGwAAAcY"]
  18. 18. [Sat Feb 10 02:05:22.490389 2018] [error] [pid 5740] mod_proxy_fcgi.c(954): (70007)The timeout specified has expired: [client 141.101.77.82:32531] AH01075: Error dispatching request to : (polling) [Sat Feb 10 03:42:55.356581 2018] [error] [pid 34419] mod_authz_core.c(873): [client 176.62.169.28:27736] AH01630: client denied by server configuration: /data/sites/web/somewebsite.com/.user.ini [Sat Feb 10 10:50:24.838424 2018] [error] [pid 41100] mod_proxy_fcgi.c(954): (70007)The timeout specified has expired: [client 162.158.111.75:24677] AH01075: Error dispatching request to : (polling) [Sat Feb 10 10:50:36.741167 2018] [error] [pid 48392] apache2_util.c(271): [client 172.68.65.254:35087] [client 172.68.65.254] ModSecurity: Access denied with code 403 (phase 2). Matched phrase "SemrushBot" at REQUEST_HEADERS:User-Agent. [file "/usr/local/httpd/conf/modsecurity-crs/activated-rules/modsecurity_crs_35_bad_robots.conf"] [line "20"] [id "990002"] [rev "2"] [msg "Request Indicates a Security Scanner Scanned the Site"] [data "mozilla/5.0 (compatible; semrushb ot/1.2~bl; +http://www.semrush.com/bot.html)"] [severity "CRITICAL"] [ver "OWASP_CRS/2.2.9"] [maturity "9"] [accuracy "9"] [tag "OWASP_CRS/AUTOMATION/SECURITY_SCANNER"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"] [h ostname “www.somewebsite.com”] [uri "/tag/romeinen/"] [unique_id "Wn7AbE4XLPnYH7fIxTBlGwAAAcY"]
  19. 19. Tue Jan 16 15:10:55.316779 2018] [error] [pid 6002] mod_proxy_fcgi.c(848): [client 178.119.78.83:63467] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Call to undefined method SitePress::is_display_as_translated_taxonomy() in /data/sites/web/somewebsite/ www/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-dependencies.php:365nStack trace:n#0 /data/sites/web/somewebsite/www/wp-includes/class-wp-hook.php(286): WCML_Dependencies->check_wpml_config('')n#1 /data/sites/web/somewebsite/www/wp-includes/ class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)n#2 /data/sites/web/somewebsite/ www/wp-includes/plugin.php(453): WP_Hook->do_action(Array)n#3 /data/sites/web/somewebsite/ www/wp-settings.php(450): do_action('init')n#4 /data/sites/web/somewebsite/www/wp- config.php(83): require_once('/data/sites/web...')n#5 /data/sites/web/somewebsite/www/wp- load.php(37): require_once('/data/sites/web...')n#6 /data/sites/web/somewebsite/www/wp-admin/ admin-ajax.php(22): require_once('/data/sites/web...')n#7 {main}n  thrown in /data/sites/web/ somewebsite/www/wp-content/plugins/woocommerce-multilingua...n'
  20. 20. Tue Jan 16 15:10:55.316779 2018] [error] [pid 6002] mod_proxy_fcgi.c(848): [client 178.119.78.83:63467] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Call to undefined method SitePress::is_display_as_translated_taxonomy() in /data/sites/web/ somewebsite/www/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-dependencies.php: 365nStack trace:n#0 /data/sites/web/somewebsite/www/wp-includes/class-wp-hook.php(286): WCML_Dependencies->check_wpml_config('')n#1 /data/sites/web/somewebsite/www/wp-includes/ class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)n#2 /data/sites/web/somewebsite/ www/wp-includes/plugin.php(453): WP_Hook->do_action(Array)n#3 /data/sites/web/somewebsite/ www/wp-settings.php(450): do_action('init')n#4 /data/sites/web/somewebsite/www/wp- config.php(83): require_once('/data/sites/web...')n#5 /data/sites/web/somewebsite/www/wp- load.php(37): require_once('/data/sites/web...')n#6 /data/sites/web/somewebsite/www/wp-admin/ admin-ajax.php(22): require_once('/data/sites/web...')n#7 {main}n  thrown in /data/sites/web/ somewebsite/www/wp-content/plugins/woocommerce-multilingua...n'
  21. 21. T H E P O W E R O F W P _ D E B U G
  22. 22. W P _ D E B U G In wp-config.php: define( 'WP_DEBUG', false ); Enable debugging: define( 'WP_DEBUG', true );
  23. 23. W P _ D E B U G Extra statements: define('WP_DEBUG_LOG', true); Creates logfile in: /wp-content/debug.log
  24. 24. W P _ D E B U G Prevent public displaying of errors: define('WP_DEBUG_DISPLAY', false);
  25. 25. W P _ D E B U G Ideal setup: define('WP_DEBUG', true);
 define('WP_DEBUG_LOG', true);
 define('WP_DEBUG_DISPLAY', false);
  26. 26. A D D I N G W P - C L I 
 T O Y O U R T O O L K I T
  27. 27. W P - C L I wp plugin list
 wp plugin deactivate
 wp plugin activate wp theme list
 wp theme deactivate
 wp theme activate wp checksum core
 wp checksum plugin (from version 1.5)
  28. 28. W P T H E M E L I S T R E S U LT Parse error: syntax error, unexpected '$z9973449' (T_VARIABLE) in /data/sites/web/somewebsite/ www/wp-includes/post-template.php on line 1 Warning: array_splice() expects parameter 1 to be array, string given in /data/sites/web/somewebsite/ www/wp-content/plugins/akismet/favicon_316779.ico(105) : eval()'d code(165) : eval()'d code(202) : eval()'d code on line 206 Warning: Invalid argument supplied for foreach() in /data/sites/web/somewebsite/www/wp-content/ plugins/akismet/favicon_316779.ico(105) : eval()'d code(165) : eval()'d code(202) : eval()'d code on line 207
  29. 29. W P T H E M E L I S T R E S U LT Parse error: syntax error, unexpected '$z9973449' (T_VARIABLE) in /data/sites/web/somewebsite/ www/wp-includes/post-template.php on line 1 Warning: array_splice() expects parameter 1 to be array, string given in /data/sites/web/somewebsite/ www/wp-content/plugins/akismet/favicon_316779.ico(105) : eval()'d code(165) : eval()'d code(202) : eval()'d code on line 206 Warning: Invalid argument supplied for foreach() in /data/sites/web/somewebsite/www/wp-content/ plugins/akismet/favicon_316779.ico(105) : eval()'d code(165) : eval()'d code(202) : eval()'d code on line 207
  30. 30. T Y P I C A L E R R O R S 
 A N D H O W T O F I X T H E M
  31. 31. Warning: Cannot modify header information - headers already sent by (output started at /data/sites/ web/somewebsite/www/wp-settings.php:84) in /data/sites/web/somewebsite/www/wp-includes/ option.php on line 920
  32. 32. Warning: Cannot modify header information - headers already sent by (output started at /data/sites/web/somewebsite/www/wp-settings.php:84) in /data/sites/web/ somewebsite/www/wp-includes/option.php on line 920
  33. 33. Warning: Cannot modify header information - headers already sent by (output started at /data/sites/web/somewebsite/www/wp-settings.php:84) in /data/sites/web/ somewebsite/www/wp-includes/option.php on line 920 Fix: 
 Enabe output_buffering
  34. 34. Q U E S T I O N S ?
  35. 35. T H A N K Y O U ! 
 S L I D E S W I L L B E T W E E T E D O N 
 @ B R E C H RY C K A E R T 
 
 A N D P U B L I S H E D O N H T T P S : / / B R E C H T RY C K A E R T. C O M

×