Fixing The 500 Internal Server Error In WordPress

So What Is a 500 Internal Server Error?

An internal server error is an application-side issue that can occur on your web server. When you write a specific URL into the address bar or if you click a link on a website, you are requesting the server to show you a page. Presently, for some reason, the server can’t show you that specific page you are seeking which signifies that you are facing an Internal Server Error.

Internal Server Error on Your WordPress Website

Just to be on the safe side, always remember that it is necessary that your hosting provider offers you automated backup.

Create a Backup

Most of the time, you are not responsible for the errors that occur on your hosted server. Since humans can make mistakes so can servers do since they are managed by people only. Some of these errors are severe and may end up compromising your whole website, therefore backing up website data on your server should be a mandatory practice.

However, if your hosting provider fails to provide you the right options to backup website data, you can try the following WordPress Backup Plugins.

How to Resolve 500 Internal Server Error on Your WordPress Website

Many reasons can be highlighted as per why the server raises a 500 Internal Server Error on your website. To fix this persistent issue, it is necessary that one should identify the cause of occurrence. The two common causes of this error to erupt on your website is corrupt .htaccess file and PHP memory limit. So without further Ado, let’s discuss how we can fix them.

The .htaccess File Error Fix

If your .htaccess file is corrupt, this can cause a 500 internal server error. The .htaccess file is usually affected by a module or a broken installation of a theme. In this case, you should first access your .htaccess file.  To determine this issue, login to your FTP account. Once logged into your FTP account, you will see a .htaccess file available in the root directory along with other folders such as wp-content, wp-include and wp-admin.

htaccess

Now that you have located your .htaccess file, you can download it from the live server to a local location on your PC. Next, open this file in your text editor (Notepad++, Dreamweaver, etc).

Navigate to this link: https://codex.wordpress.org/htaccess and copy – paste the version of the code that fits best for your website. Then, save the .htaccess file and upload it to the live server.

The code differs for different WordPress configurations and installations. Suppose you have used WordPress Multisite in WordPress 3.5 or later, then you need to use the following code:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

 

Now, reload your website to see if the 500 internal server error is fixed. If it is fixed then that would be great, but if not then navigate to the next step.

Increasing PHP Memory Limit in WordPress

Another way of fixing the 500 Internal Server Error is by increasing the PHP Memory Limit. Your host and WordPress set the PHP memory limits by default. As soon as you observe a memory drop, the server automatically displays a 500 Internal Server Error. To avoid such discrepancy, simply increase the PHP memory limit in WordPress and check whether your website works fine or not. This way you can seemingly result in avoiding the 500 Internal Server Error to occur on your website oftenly.

Some of the most common ways of increasing a WordPress website’s PHP memory limits is by altering the code in one of these files:

  • Functions.php File
  • .htaccess File
  • PHP.ini File
  • wp-Config.php File

Here is how you can tweak with these files and

Functions File

Navigate to your root directory and find function.php file. Right-click on this file, and select Download. It will download the file to your PC. Open the file in your text editor and include this bit of code below the opening PHP tag:

@ini_set('upload_max_size' , '1024M');
@ini_set('post_max_size', '1024M');
@ini_set('max_execution_time', '300');

.htaccess File

You can also use a .htaccess file for increasing PHP memory limit. Just go to your root directory, and find .htaccess file. Right-click on the file, and select Download to download it on your PC. Now, open the file in your text editor and include this bit of code below the opening PHP tag:

php_value upload_max_filesize 1024M
php_value post_max_size 1024M

 

WP-Config File

You can also use a wp-config.php file for increasing PHP memory limit. Just go to your root directory, and find wp-config.php file. Right-click on the file and select Download to download it to your PC. Open the file in your text editor and include this bit of code below the opening PHP tag:

define('WP_MEMORY_LIMIT', '1024M');
ini_set('post_max_size', '1024M');
ini_set('upload_max_filesize', '1024M');

 

PHP.ini File

You need to create a php.ini file and paste the below code in it. Upload the following code in the wp-admin/ directory.

memory_limit = 1024M
upload_max_filesize = 1024M
post_max_size = 1024M
file_uploads = On

 

If these two possible ways aren’t enough to resolve the 500 Internal Server Error, here are a few more ways through which you can avoid this Server Error to occur in your WordPress website.

Deactivate All Plugins

If you have access to the admin dashboard of your WordPress website, deactivate each plugin one by one. Refresh your website after each deactivation.

Then check your website again. If the site starts functioning properly, then the internal server error must be due to the plugin installed on your WordPress. Now, you need to activate each plugin one by one and refresh your website after each plugin activation. The problematic plugin will soon be identified as it will result in a 500 Internal Server error for your website.

Ideally, at this point, the issue has been settled. If not, move to the following step.

Fresh wp-admin & wp-includes

In this section, you need to download new wp-admin & wp-content folders and upload to live host via FTP.  Make sure that you have backed up the website before this step.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

เร่งความเร็ว WordPress ให้ทะลุจอ [ปัญหา+วิธีการ]

หลายๆคนที่ใช้งาน WordPress แล้วพบกับปัญหาการติดตั้ง Theme, Plugin เข้าไปเยอะ...

วิธีป้องกัน WordPress โดน Hack

อัพโหลดไฟล์ของ WordPress ขึ้นสู่โฮสสมบูรณ์แล้วให้ตั้งค่าดังนี้  1. ไปที่ไฟล์...

วิธีการเปลี่ยนภาษา WordPress เป็นไทยหรืออังกฤษ

วิธีการเปลี่ยนภาษา WordPress เป็นไทยหรืออังกฤษ  วิธีที่ 1 WordPress...

วิธีการป้องกัน WordPress โดนแฮก [Hack WordPress]

จากบทความที่แล้ว วิธีการ Clean Install WordPress ใหม่ทั้งหมด...

WordPress แนะนำ Plugin แก้ไข URL ในเว็บให้เป็น HTTPS

สืบเนื่องจากบทความ “.htaccess คำสั่ง Redirect HTTP ไปยัง HTTPS”...