<span style="color: #000000;">What is a 500 Internal Server Error?</span>

<span style="font-weight: 500;">One most common error that a WordPress website owner comes across as is a 500 internal server error. These errors are frustrating because they don’t have a specific reason and can be confusing to figure out what went wrong. </span>

<span style="font-weight: 500;">500 Internal server error is an HTTP status code indicating that there is some issue on the host server or within the root directory.  However, the cause of this error doesn’t necessarily have to be based on one single reason. There are multiple instances when this status code is displayed and </span><span style="font-weight: 500;">is rarely an actual server error</span><span style="font-weight: 500;">. </span>

<span style="font-weight: 500;">An internal server error is not exclusive to WordPress, it can occur on any website at any time. Most of the time an internal server error is displayed as an error message or simply a blank white page. Meanwhile, bigger brands have their custom error message for internal server error. </span>

If you are in need of professional assistance to fix 500 internal server error for your WordPress website, feel free to connect with <a href="https://vividreal.com/web-development/">our team of expert web developers</a>.

<span style="font-weight: 500;">In this article, we’ll be telling you some good solutions to fix Internal server error.</span>

<span style="color: #00ccff;"><b>1. Reload the page</b></span>

<span style="font-weight: 500;">Let’s start with the very basic step: try loading the page again. If a website is being reloaded while it’s processing the old request, a new request will be sent to the server at the same time with the first one forcing the server to respond.</span>

<span style="font-weight: 500;">Another way to identify the issue is to make use of sites (tools) that check whether a website is down or not. If these tools receive anything other than HTTP 200 status code (Everything is OK), then it indicates that the website is down. </span>

<span style="color: #00ccff;"><b>2. Clear browser history</b></span>

<span style="font-weight: 500;">Clear the browser history and then try to reload the page. This should be one of the first steps to be taken before proceeding with any deeper debugging step on your website.  </span>

<span style="color: #00ccff;"><b>3. Debugging</b></span>

<span style="font-weight: 500;">WordPress offers a provision to debug using its built-in debugging feature. Debugging may not necessarily fix the problem but it can provide some insights on the issue.</span>

<span style="font-weight: 500;">Here’s WordPress’s debugging process explained in simple steps.</span>
<ul>
 	<li style="font-weight: 400;"><span style="font-weight: 500;">Access your site’s wp-config.php file from the root folder of the website. </span></li>
 	<li style="font-weight: 400;"><span style="font-weight: 500;">Inside the file, search for “</span>WP_DEBUG<span style="font-weight: 500;">” (which is a PHP constant used as a permanent global variable for debugging purposes in WordPress). </span></li>
 	<li style="font-weight: 400;"><span style="font-weight: 500;">Now set the variable WP_DEBUG as “true” to start with the debugging process.</span></li>
</ul>
<span style="font-weight: 500;">It should look like this:</span>
<p style="padding-left: 80px;"><span style="font-weight: 400;">define( "WP_DEBUG", true );</span></p>
<span style="font-weight: 500;">Reload the website after saving this change and if this error gets fixed, a new error will definitely pop up. Now, this new error will help you figure out what the exact problem is. Moreover, you may observe the error location and fix it right away! If it points to a plugin folder, you can easily deactivate the plugin to remove the error.</span>

<span style="color: #00ccff;"><b>4. Plugins and themes</b></span>

<span style="font-weight: 500;">Plugins and themes are an inevitable part of WordPress and there are chances of encountering a 500 internal server error because of this</span><span style="font-weight: 500;">.</span><span style="font-weight: 500;"> An error can occur immediately after installing a plugin/theme or while running an update for the same. </span>

<span style="font-weight: 500;">One way to troubleshoot this is to deactivate all your plugins and reload the website to check if they were the ones causing the error. Deactivation is recommended over deletion because you wouldn’t lose any of your data in the former </span>

<span style="font-weight: 500;">Now reactivate them one at a time and try reloading the website each time. This way you can easily figure out the plugin causing the problem. You can connect with the plugin developer and ask for help or post about it in the WordPress support forum.</span>

<img class="size-full wp-image-7938 aligncenter" src="http://localhost/vividreal/wp-content/uploads/2020/04/2020-04-08-2.png" alt="WP_Screenshot_Eg" width="1366" height="620" />

<span style="font-weight: 500;">If this doesn’t work because you are unable to access the admin side, access your FTP server, SFTP server or hosting account’s Cpanel dashboard. Rename all the plugins folder as something like old_plugins and try reloading the website again. </span>

<span style="font-weight: 500;">If the site gets reloaded, you rename the folder to its old name, start renaming each plugin inside the folder and simultaneously reload the website. If this works, you’ve figured out the culprit!</span>

<span style="font-weight: 500;">The same thing goes with the theme as well, at times certain themes can cause such errors (while installing or updating). Check the themes just like the way you did with the plugins. Also, use the WordPress default theme (optimized theme) if there are any theme related issues.</span>

<span style="color: #00ccff;"><b>5. Database connection error</b></span>

<span style="font-weight: 500;">A database connection error is the most commonly observed error in WordPress. This error occurs when there is an error while the PHP code tries to establish a connection with the MySQL database. As the website is unable to establish a connection with the server, this error is always shown on a blank page. </span>

<span style="font-weight: 500;">This can occur for 2 reasons; one simple reason is that the login credentials may be incorrect, while the other one is that there are chances for a database error.  </span>

<span style="color: #00ccff;"><b>6. Reinstall WordPress</b></span>

<span style="font-weight: 500;">At times some old sites can get an internal server error when some core WordPress files get corrupted. Reinstalling WordPress can be done without affecting the already installed plugins or themes. </span>

<span style="font-weight: 500;">Try re-uploading the </span>wp-admin and wp-includes folders once the new WordPress is installed using these simple steps:
<ul>
 	<li style="list-style-type: none;">
<ul>
 	<li style="list-style-type: none;">
<ul>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">Download the WordPress zip file from the WordPress.org site. </span></li>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">Extract the WordPress file and access the WordPress folder. </span></li>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">Connect the WordPress website via an FTP client.</span></li>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">Once you get the access, you can view the folder which contains wp-admin, wp-includes, and wp-content. </span></li>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">Open the WordPress folder from your computer and select wp-admin &amp; wp-includes to upload them. </span></li>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">The FTP client now transfers the file to the server and asks if it should be overwritten. </span></li>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">Now select ‘overwrite’ and ‘Always use this action’.</span></li>
</ul>
</li>
</ul>
</li>
</ul>
<span style="color: #00ccff;"><b>7. Permission error</b></span>

<span style="font-weight: 500;">Sometimes even a permission error can be a reason showing an internal server error. Even though the chances of such an error occurring is very less, let’s not spare a possibility to remove error 500. </span>

<span style="font-weight: 500;">Access your WordPress root directory using an FTP client and check if the permission for files and folders are set to either </span>755 or 644<span style="font-weight: 500;">. Also, remember setting it to any other number would cause an error.</span>

<span style="color: #00ccff;"><b>8. Expand PHP memory limit</b></span>

<span style="font-weight: 500;">An exhausted PHP server memory can be one reason for an internal server error. This can be resolved if the PHP memory limit is increased. </span>

<span style="font-weight: 500;">There are chances for a 500 error code showing up while trying to log in the WordPress admin or when uploading an image in wp-admin, at those instances you can expand the memory limit using the following steps.</span>
<ul>
 	<li style="list-style-type: none;">
<ul>
 	<li style="list-style-type: none;">
<ul>
 	<li style="font-weight: 500;"><span style="font-weight: 500;">Create a new file,</span> php.ini in the root directory</li>
 	<li style="font-weight: 500;">Write the code, memory=64MB on it.</li>
 	<li style="font-weight: 500;">Save and upload it in wp-admin via FTP server, SFTP server or hosting account’s Cpanel dashboard.</li>
</ul>
</li>
</ul>
</li>
</ul>
Or the same thing can be done by accessing your site’s wp-config.php file from the root folder of the website and search for “WP_MEMORY_LIMIT” within. Now change its value to “64M”.

<span style="font-weight: 500;">It should look like this:</span>
<p style="padding-left: 80px;"><span style="font-weight: 400;">define('WP_MEMORY_LIMIT', '64M');</span></p>
<span style="font-weight: 500;">Don’t be relieved if this code fixed your error, now you need to figure out what is exhausting the PHP memory. A poorly-developed plugin or theme function can cause this, while it's highly recommended if you can contact your hosting provider and get details from the server logs.</span>

<span style="color: #00ccff;"><b>9. Check your .htaccess file</b></span>

<span style="font-weight: 500;">A corrupted .htaccess file is one of the most common reasons for internal server error if your WordPress host is running on Apache. </span>

<span style="font-weight: 500;">Access your FTP server, SFTP server, or hosting account’s Cpanel dashboard and rename your .htaccess file into .htaccess_old. Now, if the website reloads, the error is fixed!</span>

<span style="font-weight: 500;">You can create a new .htaccess file with the following contents, and then upload it to the server.</span>
<p style="padding-left: 80px;"><span style="font-weight: 400;"># BEGIN WordPress</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">&lt;IfModule mod_rewrite.c&gt;</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">RewriteEngine On</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">RewriteBase /</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">RewriteRule ^index\.php$ - [L]</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">RewriteCond %{REQUEST_FILENAME} !-f</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">RewriteCond %{REQUEST_FILENAME} !-d</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">RewriteRule . /index.php [L]</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;">&lt;/IfModule&gt;</span></p>
<p style="padding-left: 80px;"><span style="font-weight: 400;"># END WordPress</span></p>
<span style="font-weight: 500;">Or you can directly go to </span>Settings » Permalinks<span style="font-weight: 500;"> page in the WordPress admin part and save the data on it without making any changes. This action will generate a new .htaccess file.</span>

<span style="color: #00ccff;"><b>10. PHP timeouts</b></span>

<span style="font-weight: 500;">Error 500 can occur during PHP Timeouts. A PHP timeout is a result of a lack of PHP workers.  </span>

<span style="font-weight: 500;">For example, you have 4 requests coming to the website at the same time, with you having only 2 PHP workers. Now 2 requests out of them would be processed immediately while the other 2 requests need to wait until the others finish. </span>

<span style="font-weight: 500;">Processing further requests can happen instantly if there are no complex themes or a lot of plugins used on the website. The problem arises when there are too many requests and it would be left uncached if the PHP workers can’t handle them. So it's always advisable to estimate the number of PHP workers you require for the website and work over it. </span>

<span style="color: #00ccff;"><b>Conclusion</b></span>

<span style="font-weight: 500;">When the website goes down, you are losing a lot of visitors and affecting website traffic seriously along with degrading the brand name! On top of that, Google detects such occurrences on a website and can demote the website to alert that the error needs to be addressed.  </span>

<span style="font-weight: 500;">Make sure that all your website’s plugins, themes, and WordPress core files are up-to-date.  Ensure that the theme you use is compatible with your plugins.</span>

<span style="font-weight: 500;">Use tools that monitor any kind of error occurring on your website so that you can have a track on them. These tools can alert you whenever the site goes down by simply sending you an email. This also means that it can monitor and pass information to you even at an interval of 15 seconds. </span>

<span style="font-weight: 500;">Ask your hosting provider for support if all these techniques didn’t help you figure out the reason for a 500 internal server error. You can ask them to check the server logs and identify the root cause for the error. </span>

<span style="font-weight: 500;">If all of this seems confusing to you, do not worry! <a href="https://vividreal.com/web-development/">Our team of expert website developers</a> can definitely help you fix the 500 internal server error for your WordPress website.</span>