battling the white screen of death

39
Battling the WSOD A Tech Support Tale

Upload: keith-hyde

Post on 15-Apr-2017

268 views

Category:

Internet


1 download

TRANSCRIPT

Page 1: Battling the White Screen of Death

Battling the WSODA Tech Support Tale

Page 2: Battling the White Screen of Death

Keith Hyde

Kayleigh Thorpe

WordPress & Systems Specialist@Keithage

WordPress Support Specialist@Kayleighthorpe

Page 3: Battling the White Screen of Death

Coming up• White Screen of Death• Plugin issues • Theme issues• Useful tools• Hacked Sites & Restoration• Additional common support queries• Handy wp-cli commands

WP-CLI

http://wp-cli.org

Page 4: Battling the White Screen of Death

Have you ever visited your website to see this?

We call this the ‘White Screen of Death’.

Page 5: Battling the White Screen of Death

Plugin Issues

Page 6: Battling the White Screen of Death

• The first step when faced with the WSOD is to check your error logs. These usually provide helpful insights to where the issue is coming from.

• They are usually accessible via FTP - in most cases you can find error logs stored in a folder just below your site’s root directory.

• Example log entry:

Searching Error Logs

Page 7: Battling the White Screen of Death

Finding logs via FTP

Page 8: Battling the White Screen of Death

How do I fix a plugin issue?• Check for updates - updates may have been made to

fix some plugin issues you may be having.

• Disable the plugin - disabling plugins with coding errors in them usually fixes the problem, from there it may be worth re-installing the plugin.

• In case of WSOD where there is no access to the WordPress admin panel - you want to know how to safely remove the plugin.

Page 9: Battling the White Screen of Death

Safely disable plugins

>

Disable a plugin by renaming it via FTP / File Manager:

Disable a plugin via WP-CLI:

wp plugin deactivate plugin-name --skip-plugins

Page 10: Battling the White Screen of Death

After disabling the offending plugin:

Page 11: Battling the White Screen of Death

Theme Issues

Page 12: Battling the White Screen of Death
Page 13: Battling the White Screen of Death

Theme Issues

Changing your theme FTP / File Manager:

>

If you rename your theme via FTP this will disable the theme - but it will cause your site to display a white screen on all pages except the wp-admin section. You can go directly to the wp-admin section and enable a safe theme after doing this.

Page 14: Battling the White Screen of Death

Theme Issues

Changing your theme via WP-CLI:

wp theme activate theme-name --skip-themes

Page 15: Battling the White Screen of Death

Memory Issues

Memory issues are commonly caused because a theme needs more memory than WordPress has allocated to it.

To fix this you need to allocate more memory to WordPress. You can add this line to your wp-config.php:

define('WP_MEMORY_LIMIT', '64M');

Depending on your hosting set up this value may need to be stored elsewhere - ask your host if you are unsure!

Page 16: Battling the White Screen of Death

The Nastier Problems: Hacked Sites

Page 17: Battling the White Screen of Death

ClamAVan open source (GPL) anti-virus engine which includes command line scanning to check files and folders for issues.

clamav.net

WP-CLIWP-CLI allows us to scan the WordPress core feels for changes - the vast majority of WordPress sites should not need any changes making to their core files. This is a good indication of an issue.

wp core verify-checksums

Some quick checks if you suspect an issue:

Page 18: Battling the White Screen of Death

Creating a clean WordPress Install1. Use the WordPress Export tool to create a copy of your custom content - your posts, pages, comments, meta data and media. This will store the content in a .XML file for later import.

2. Create a brand new WordPress installation - new database, users and no theme/plugins.

3. Create your users - they are not backed up.

4. Run the import tool from within WordPress - this will restore your custom content on to the new site.

5. You will then be given the option to assign imported authors to existing authors on your website.

6. Re-install your plugins and theme from the WordPress repository.

Page 19: Battling the White Screen of Death

WPScan

wpscan.org

WPScan is a command line tool you can install on your server which scans WordPress websites for known vulnerabilities, as well as offering advice on how you can make security improvements to your WordPress install.

Page 20: Battling the White Screen of Death

Other common support queries

Page 21: Battling the White Screen of Death

Changing your user’s passwords1. Login to the WordPress admin dashboard2. Select ‘Users’ then ‘All Users’ from the side

menu.3. Click on the username you wish to edit. 4. Scroll down to ‘Account Management’ to set

a new password, change it, and hit ‘Update Profile’.

Page 22: Battling the White Screen of Death

Preventing spam commentsWordPress sites are victim to a lot of spam commenters. There are many ways to prevent and reduce the number of comments you are getting.

Installing a plugin to tackle the spam comments is recommended.

There are many spam protection plugins to choose from:

• Akismet• SI Captcha Spam• Tick Captcha• WP Spam IP• Anti-Spam

Page 23: Battling the White Screen of Death

define('WP_DEBUG',true);

[06-Sep-2016 19:58:10 UTC] PHP Notice: Trying to get property of non-object in /var/www/vhosts/mr-badger.co.uk/httpdocs/wp-content/plugins/akismet/class.akismet.php on

line 173

Enabling WP_Debug

Sometimes you will encounter issues where your error logs may not be offering any clear insights. A good extra check is to enable WP_Debug - this will enable extra error logs to display directly on your WordPress pages.

Page 24: Battling the White Screen of Death

Additional Safety Tips• Enable automatic updates

• Security plugins such as ‘Sucuri’, ’Limit Login Attempts’

• xmlrpc.php protection

• Host security - Fail2ban

• Use passphrases and two factor authentication

• Make sure you are setting the correct user roles

Page 25: Battling the White Screen of Death

Additional Support Queries and Tips

Page 26: Battling the White Screen of Death

• Running out of disk space• Set a reasonable backup schedule• Only backup wp-content and database.• Try to use a remote storage solution -

Dropbox, Google Drive.

Common backup plugin issues & tips

Page 27: Battling the White Screen of Death

Fixing broken permalinks1. Login to your WordPress

Dashboard2. Click on ‘Settings’ > ‘Permalinks’3. Switch permalinks to default4. Switch permalinks back

Note: Ensure .htaccess is writable by the server.

Page 28: Battling the White Screen of Death

Managing Transients

Page 29: Battling the White Screen of Death

Transient IssuesTransients are options temporarily stored in your database. Many of these can cause your site to become slow.• You can remove unused transients

by installing the ‘Transient Manager’ plugin.

• Alternatively consider setting up key storage such as Redis on your server.

Page 30: Battling the White Screen of Death

File ownership / permission issues Sometimes WordPress will behave strangely. Such as asking for FTP details to install a plugin:This is a common result of incorrect file ownership or permissions. Always ensure you have your files and folders set correctly.

Most times files should have their permissions set to 644 and directories to 755. But ask your host if you are worried about setting the correct file permissions.

Do not set permissions to 777

Page 31: Battling the White Screen of Death

Always disable caching on your site when you are developing or regularly flush the cache to see your updated content.

You can flush your cache using WP-CLI:

wp cache flush

Caching

Page 32: Battling the White Screen of Death

Useful WP-CLI commands

Page 33: Battling the White Screen of Death

wp corewp core offers commands related to the core WordPress file setup.

Favourite useful commands:

• wp core update• wp core download• wp core version• wp core verify-checksums

Page 34: Battling the White Screen of Death

wp optionwp option is used for managing options within WordPress

Favourite useful commands:

• wp option get siteurl• wp option get home• wp option update siteurl http://correctsiteurl.com• wp option update home http://correctsiteurl.com- Great for newly migrated sites

Page 35: Battling the White Screen of Death

wp pluginwp plugin commands allow you to edit and manage your plugins

Favourite useful commands:

• wp plugin list• wp plugin deactivate plugin-name• wp plugin update plugin-name

Page 36: Battling the White Screen of Death

wp themewp theme commands allow you to edit and manage your themes

Favourite useful commands:

• wp theme activate theme-name• wp theme update theme-name

Page 37: Battling the White Screen of Death

wp dbwp db allows you to manage your database using WP-CLI

Favourite useful commands:

• wp db import mydatabase.sql• wp db repair• wp db cli

Page 38: Battling the White Screen of Death

wp userwp user allows you to manage your WordPress site’s users

Favourite useful commands:

• wp user list• wp user delete #

Creating a new administrator account:

Page 39: Battling the White Screen of Death

Thank you!Link Creditshttp://wp-cli.orghttps://www.clamav.nethttps://codex.wordpress.orghttps://www.34sp.com

@Kayleighthorpe@Keithage

Any thoughts or questions?