{"id":619,"date":"2017-02-06T10:56:59","date_gmt":"2017-02-06T10:56:59","guid":{"rendered":"http:\/\/blog.azoora.com\/?p=619"},"modified":"2017-08-20T08:15:55","modified_gmt":"2017-08-20T08:15:55","slug":"the-ultimate-guide-to-solving-500-internal-server-errors-and-blank-white-pages-in-wordpress","status":"publish","type":"post","link":"https:\/\/azoora.com\/blog\/code\/the-ultimate-guide-to-solving-500-internal-server-errors-and-blank-white-pages-in-wordpress\/","title":{"rendered":"The Ultimate Guide to Solving 500 Internal Server Errors and Blank White Pages in WordPress"},"content":{"rendered":"<p>The 500 Internal Server Error is the most unhelpful and nondescript bane of web developers everywhere. It\u2019s a catch-all error message that can literally mean anything. Sometimes, your WordPress site gives no error at all and just shows a blank page. How on earth are you supposed to figure out what\u2019s wrong?<\/p>\n<p>It happens to the best of us, but no need to panic. Here\u2019s my own debug process, in order of likelihood and with solutions.<\/p>\n<h2>Plugins<\/h2>\n<p>If you\u2019ve just installed a new plugin or if your site is showing 500 errors after a core WordPress upgrade, the most likely cause is an incompatible plugin. There are many reasons for a plugin being \u201cbroken\u201d:<\/p>\n<ul>\n<li>WordPress may have removed some core functions the plugin uses.<\/li>\n<li>The plugin may have been coded for an old version of PHP, and not been updated.<\/li>\n<li>It could just be coded incorrectly, by referring to default database names rather than using prefixes, for example.<\/li>\n<\/ul>\n<p>Identifying the plugin is easy if you\u2019ve just installed one and the error has emerged, but how can you disable the plugin if it\u2019s taken down the wp-admin area of your site too? You\u2019ll need FTP access, is the short answer, though the web-based file manager from CPanel or Plesk will work fine too.<\/p>\n<h3>Solution:<\/h3>\n<p>All you need to do is rename the wp-content\/plugins\/ folder. Place a _ in front of the plugins folder, so it\u2019s named _plugins, and you should now be able to login again to your WordPress admin area. By renaming the folder, you effectively de-activated every plugin \u2013 you should get a bunch of error messages from WordPress saying \u201cX plugin was deactivated because the file Y.php can\u2019t be found\u201d. Don\u2019t worry, you won\u2019t have lost any settings \u2013 those are stored in the database, and any decent plugin should find them again upon re-activation.<\/p>\n<p>Rename the folder back again, removing the _. Refresh the WordPress plugins and they\u2019ll all be listed again, but in a deactivated state. You can now re-activate them one by one until you find the culprit; then do it all again, obviously leaving out the bad plugin this time.<\/p>\n<p>It\u2019s unfortunate when this happens, but chances are there\u2019s a better plugin out there that is compatible. Find it.<\/p>\n<h2>Incompatible Theme<\/h2>\n<p>Disabling plugins didn\u2019t help? It\u2019s probably something in your theme, then. Just like plugins, you can force the active theme to break by simply renaming it. Go back to the WordPress admin area (if you can, of course \u2013 if you can\u2019t, it\u2019s probably nothing to do with your theme) and WordPress will alert you that it\u2019s fallen back to the default theme. Check the site again. Of course, this doesn\u2019t really help if you\u2019re committed to a particular theme, so may want to re-enable it and head down to the section on Enabling PHP Debug; or just go and find a newer, compatible theme.<\/p>\n<h2>Bad .htaccess<\/h2>\n<p>If de-activating your plugins achieved nothing and it\u2019s also not your theme, it\u2019s possible that your .htaccess file became corrupted in some way. Usually when this happens you can still access the admin area of the site. The\u00a0.htaccess\u00a0file handles rewrite rules and cache settings, but sometimes you\u2019ll edit this file directly to manually code in things like 301 redirects.<\/p>\n<h3>Solution:<\/h3>\n<p>Rename the .htaccess file in the root of your WordPress install folder to something like .htaccess_old. If you can\u2019t actually see the file there, you need to enable viewing of hidden files\u00a0\u2013 the exact method of doing that will vary according to your FTP client. The \u201c.\u201d at the start of the filename is a way of saying \u201chide this\u201d in Linux and other UNIX-like systems.<\/p>\n<p>Once you\u2019ve renamed the current .htaccess, go back to WordPress admin area, then head over to Settings -&gt; Permalinks and, without making any changes, hit save. This will automatically generate a new working version of the file, though any changes you made manually will be lost.<\/p>\n<h2>Enable PHP Debugging<\/h2>\n<p>We can enable a debug log from within WordPress config, which might give a clue as to the exact problem \u2013 but at this point you\u2019re on your own. You\u2019ll need to figure out how to fix it, which will require coding skills.<\/p>\n<p>To enable the debug log, open up wp-config.php in the root of your WordPress install. Find the line that says:<\/p>\n<blockquote><p>define(&#8216;WP_DEBUG&#8217;, false);<\/p><\/blockquote>\n<p>Comment it out using \/\/ at the start, then paste in the following:<\/p>\n<blockquote><p>define(&#8216;WP_DEBUG&#8217;, true);<br \/>\ndefine(&#8216;WP_DEBUG_LOG&#8217;, true);<br \/>\ndefine(&#8216;WP_DEBUG_DISPLAY&#8217;, false);<br \/>\n@ini_set(&#8216;display_errors&#8217;,0);<\/p><\/blockquote>\n<p>This will start outputting errors to a file in wp-content folder called error.log. If you refresh your FTP and see nothing after a minute or so, it\u2019s possible it doesn\u2019t have permission to create the file. Manually create a new error.log file and give it permission 666.<\/p>\n<p><img data-attachment-id=\"634\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/the-ultimate-guide-to-solving-500-internal-server-errors-and-blank-white-pages-in-wordpress\/attachment\/direct\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct.png\" data-orig-size=\"585,308\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"direct\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct-300x158.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct.png\" loading=\"lazy\" class=\"alignnone size-full wp-image-634\" src=\"http:\/\/blog.azoora.com\/wp-content\/uploads\/2017\/06\/direct.png\" alt=\"direct.png\" width=\"585\" height=\"308\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct.png 585w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct-300x158.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct-580x305.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct-320x168.png 320w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/p>\n<p>Be warned: this file will continue to grow larger until you remove those lines from your config. Don\u2019t forget to uncomment the original line as well. Read the file in any text editor, and check for any critical PHP errors. In this example, I see a lot of PHP Notices about deprecated code, but these won\u2019t actually break a site.<\/p>\n<p><img data-attachment-id=\"636\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/the-ultimate-guide-to-solving-500-internal-server-errors-and-blank-white-pages-in-wordpress\/attachment\/direct2\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct2.png\" data-orig-size=\"539,258\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"direct2\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct2-300x144.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct2.png\" loading=\"lazy\" class=\"alignnone size-full wp-image-636\" src=\"http:\/\/blog.azoora.com\/wp-content\/uploads\/2017\/06\/direct2.png\" alt=\"direct2.png\" width=\"539\" height=\"258\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct2.png 539w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct2-300x144.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/direct2-320x153.png 320w\" sizes=\"(max-width: 539px) 100vw, 539px\" \/><\/p>\n<h2>Server config<\/h2>\n<p>I recently had a case where roughly half of all page loads were coming up as 500, but with no set pattern and absolutely nothing helpful in the error logs. Activiting WordPress debug logs showed nothing obvious \u2013 lots of PHP notices and deprecations but nothing critical. Finally, I realised I had installed APC caching onto the server the weekend before, to use with W3 Total Cache. Uninstalling that completely eradicated the 500 errors.<\/p>\n<p>On a shared host, you may find the PHP memory limit is being hit \u2013 particularly complex plugins could cause this. If you\u2019re lucky you\u2019ll get an error message too along the lines of \u201cFatal Error: Allowed memory size of xxx bytes exhausted\u201d,\u00a0but not always. You may be able to fix this by adding the following line to your wp-config.php:<\/p>\n<blockquote><p>define(&#8216;WP_MEMORY_LIMIT&#8217;, &#8217;64M&#8217;);<\/p><\/blockquote>\n<p>I say may, because most shared hosts won\u2019t actually let you increase the memory limit \u2013 you take what you\u2019re given. Perhaps it\u2019s time to consider <a href=\"http:\/\/themightyroar.com\" target=\"_blank\" rel=\"noopener\">a differnt host<\/a>?<\/p>\n<p>Of course, if you\u2019d taken backups before running any upgrades How To Backup &amp; Restore Your WordPress Site Easily With UpdraftPlus How To Backup &amp; Restore Your WordPress Site Easily With UpdraftPlus Read More \u00a0you\u2019d have an easy route to recovery.<\/p>\n<p>It\u2019s terrible when your site goes down \u2013 especially if it\u2019s a source of income for you and not just a hobby \u2013 but by following this guide and being methodical, you should have it back up again soon.<\/p>\n<p>If you&#8217;re already exhausted &amp; cannot afford downtime, we suggest <a href=\"https:\/\/www.azoora.com\">hiring a professional\/agency<\/a> to fix it for you.<\/p>\n<p>Have you ever had a 500 Internal Server Error or blank page that wasn\u2019t solved by one of these? Let us know what your problem was, and how you fixed it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The 500 Internal Server Error is the most unhelpful and nondescript bane of web developers everywhere. It\u2019s a catch-all error message that can literally mean anything. Sometimes, your WordPress site gives no error at all and just shows a blank page. How on earth are you supposed to figure out what\u2019s wrong? It happens to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":646,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[4,59],"tags":[60,61],"jetpack_featured_media_url":"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2017\/06\/500-internal-server-error-1-700x400.jpg","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p7FQPL-9Z","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/619"}],"collection":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/comments?post=619"}],"version-history":[{"count":25,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":647,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/619\/revisions\/647"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media\/646"}],"wp:attachment":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/tags?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}