Learn How to Fix Internal Server Error in a WordPress Site
Okay, so, you are encountering a WordPress error message. Don’t worry! With a little caution and patience, you can fix it.
An unexpected error can be frustrating and is enough to sully your day. WordPress will never throw errors at you without reason. There can be a lot of reasons for an internal server error; it can be frustrating when you don’t know how to fix the internal server error. The generic nature of this error makes it difficult for developers to fix it. However, there are many ways to fix the code and ensure better performance of your WordPress website.
Let’s discover what is the reason behind the status code and what steps you can take to solve the problem.
Causes of Internal Server Error
The 500 internal server error is caused due to any WordPress applications that went wrong on the website’s end. It clearly shows that the script or plugin did something wrong that made your site’s server to crash. Ask your host if they are doing something on their end. If that is not the case and your host tells you that the server is fine, try to figure out the cause on your end. It is advised to double-check whether your server is working or not by accessing your web hosting file manager and upload the file. If your server is working, the address will load, and if you still get a server error on WordPress, it shows your server is not working.
Other possible reasons for internal server error in WordPress include plugin or theme functions, corrupted .htaccess file, and PHP memory limit. Let’s figure out how to troubleshoot the internal server error in WordPress.
How to Fix the Internal Server Error on WordPress Website
- Create a Backup
- Create a New.htaccess File
- Increase Your PHP Limit
- Deactivate all Outdated Plugins
- Check Your Theme
- Re-upload WordPress Files
- Debugging Your WordPress Website
Create a Backup
Most of the time, server errors are very dangerous and may end up compromising your whole website. Therefore, it is important to backup your WordPress site on the server before fixing the error. If your web hosting provider didn’t provide you with the right options to backup your WordPress website data, you can install WordPress backup plugins. Here is a list of top WordPress backup plugins you can install to backup your WordPress website data.
- UpdraftPlus
- VaultPress
- BackupBuddy
- BoldGrid Backup
- BlogVault
- BackWPup
- Duplicator
These plugins will offer complete WordPress file backup and database backup features.
Create a New .htaccess File
One of the most common reasons of 500 internal server error is the corrupted .htaccess file after installation of a plugin or making other changes to your website. If that is the case and your .htaccess file is corrupted, the only solution is to create a new .htaccess file. If it is corrupted due to the broken installation of a theme, you should access your .htaccess file. To solve the issue, log into your FTP account and find the .htaccess file in the root directory. Once you find the .htaccess file, right-click it and rename it, htaccess.bak. It will delete the existing. htaccess file. Now you have to create the new file. For this, go to the WordPress admin panel, go to settings and select permalinks. Scroll down and click save changes.
Now open your website, if the 500 internal servers is fixed, then it is confirmed that the main culprit was corrupted .htaccess file. If you are still facing the same issue, then move on to step no. 2.
Increase Your PHP Limit
PHP memory limit is another common cause of internal server error. Your web hosting provider and WordPress site set the PHP memory limit by default. When you observe a memory shortage, the server automatically shows a 500 internal server error. Increasing the PHP limit on your WordPress website is the simplest solution to solve the problem. But how.
There are some easiest ways to increase the PHP limit of your WordPress website. All you need to do is to alter the code in any of these files, including:
- wp-Config.php File
- Functions.php File
- .htaccess File
- PHP.ini File
How to Change the Code of wp-config.php File?
The wp-config.phpfileis located in the WordPress root folder, to access this file, use a file manager in your web hosting control panel. Once you find the wp-config.phpfile, right-click it and select download to save in your pc. Now open the file in a text editor and add the following codes before the opening PHP tag.
define(‘WP_MEMORY_LIMIT’, ’64M’);
ini_set(‘post_max_size’, ’64M’);
ini_set(‘upload_max_filesize’, ’64M’);
How to Change the Code of Functions.php File?
Go to the root directory and search function.php. Right-click on the file and select download. Open the file in the text editor and add the following code under the opening PHP tag.
@ini_set(‘upload_max_size’ , ’64M’);
@ini_set(‘post_max_size’, ’64M’);
@ini_set(‘max_execution_time’, ‘300’);
How to Change the code of .htaccess File?
To increase the PHP memory limit, go to the root directory, find .htaccess file, right-click on the file and download it. Open the file in a text editor and add this code below the opening PHP tag.
php_valueupload_max_filesize 64M
php_valuepost_max_size 64M
Deactivate all Outdated Plugins
If your plugins are not updated with the latest WordPress security patches, chances are it will lead to error in your WordPress website. Therefore, it is important to go to the admin panel, check all your plugins carefully, and deactivate the outdated ones.
Now refresh your website, if your site starts working, then the internal server error was due to the faulty plugins. Now activate the plugins one by one until you figure out which one is causing the WordPress internal server error.
Check Your Theme
Your WordPress theme can be the main cause of internal server error. To make sure the error is being caused by the theme, go to the WP-CONTENT > THEMES. Rename the THEMES folder and refresh the site. If it works, then it will confirm that the theme is the issue.
Re-upload WordPress Files
If any of the above-mentioned options didn’t solve the internal server error, try re-uploading your wp-admin and wp-includes folder. Don’t worry; it will not remove your data; it will solve the problem and help you figure out which file is actually causing the error.
Go to the Wordspress.org. Click the download button. Extract the zip file and locate a WordPress folder. Now connect to your website using FTP client. Go to the root directory where you will find wp-admin, wp-includes, and wp-content folders.
Now go to the WordPress folder that you just downloaded. Select wp-includes and wp-admin folders and right-click to select upload. The FTP client will start transferring those folders to the server. You will be asked to overwrite the files. Select the option “overwrite” and “always use this action.”The newer ones will replace your old WordPress files.
Your internal server error will be solved if the WordPress files were the major culprit.
Debugging Your WordPress Website
When your WordPress website faces a server error, it is advised to turn your debugging on. Though it will not solve the problem, it will help you fix the error.
To turn on debugging, edit your website’s wp-config.php file. Find WP_DEBUG and set it to the option true. If you didn’t find it, create it by yourself. Once saved, refresh the site; if server error disappears, great! If not, leave the debugging feature turn on until the issue is resolved. It will help your website development team to find what is causing the 500 internal server error.
There is no denying the fact that the 500 internal server error is very frustrating. It needs a lot of knowledge and precautionary steps to get rid of this problem. Hopefully, these steps will help you solve the WordPress 500 internal server error.