×


WHM Internal server error 500 - Fix it Now ?

Sometimes, While accessing WHM panel or cPanel, users at times notice an "Internal server error 500" message. This usually happens when one of the cPanel processes is failing.

Also note that A 500 Internal Server error can be caused by many things, including but not limited to invalid permissions, invalid ownership, bad lines in your php.ini or .htaccess file, invalid requests in the script, and others not mentioned here.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve related WHM errors.

In this context, we shall look into methods to fix 500 Internal Server Error.


Main cause of WHM Internal server error 500 ?

Just recently we received a request from one of our customers that they are receiving an "internal server error" as shown below while accessing WHM:

Internal Server Error 500

Basically, this error can happen in a number of scenarios. For instance, while using ConfigServer WHM plugins,  while setting up two-factor authentication,  or randomly when they try to login to WHM or cPanel interface.

The exact reason for this error may vary based on the particular situation. However, this error usually happens due to one of the cPanel processes failing to load or still running in the background.

In most cases, Checking the Error Logs in cPanel for specific information is highly recommended.


How to Check Error Logs in cPanel ?

1. Open the File Manager.

2. Locate the error logs within the problem website's assigned folder.

/home/cpanel_user/public_html/error_log for the Primary Domain.


How to resolve WHM Internal server error 500 ?

The exact steps to fix the error may vary based on the reason for the error. To have a better idea on what is the reason, We check the cPanel error log:

tail -f /usr/local/cpanel/logs/error_log

This error log helps to identify the reason for the error. In most cases running a cPanel update helps to fix the error. 

i. For this,  initially, we need to Stop the cPanel service with the command below:

$ service cpanel stop

ii. Now we update cPanel/WHM with the command:

$ /scripts/upcp –force

iii. This command only updates the control panel software. Once the update is over, we can start the services by issuing this line:

$ service cpanel start


500 error caused by Bad permissions, Writable by group

A bad permissions error may be seen by the Administrator.

Here, the folder had permissions for a folder set too high. The permissions need to be changed from "777" to "755" to solve it.

Directories and folders should be 755. Executable scripts within the cgi-bin folder must be 755. Images, media, and text files like HTML should be 644.

i. Files - 644
ii. CGI Scripts - 755
iii. Directories - 755

You can modify permissions with the File Manager, located in the "Files" category of the cPanel.



Conflicts with using ConfigServer WHM plugins

ConfigServer plugins need access to some IP addresses. If they are not whitelisted on the server, it is possible for them to get blocked. This in turn can trigger the "500 error".

Thus to fix the error, we need to remove them from the blocklist and then whitelist it by adding them in the "/etc/csf.allow" file:

54.36.165.115 # download2.configserver.com
94.130.90.175 # download.configserver.com
66.165.246.166 # license.configserver.com
2604:4500:9:156::6 # ipv6.license.configserver.com


Troubleshooting Index Files

If there are no error messages in the error_logs, there may be multiple index files in the domain's root folder.

Note: If the default file (index.html, index.php, default.html) is empty, the page will appear as the WSOD. It is important to check the directory index, noting file size.

To check, open the file manager:

  • Choose the folder the domain you are working on is pointed to.
  • Locate any additional index files besides index.php.
  • If other index files are present, temporarily rename them (so that they are not recognized as an index file).
  • Note: If this fixes the issue, the customer will need to move the duplicate index file(s) elsewhere. 


Troubleshooting the .htaccess

If you have ruled out both the Theme and Plugins, you can move on to the .htaccess:

1. To access this, open the file manager and add &showhidden=all to the end of the URL.

2. Choose the folder the domain you are working on is pointed to.

3. Rename the current .htaccess to .htaccess(currentdate). This disables the current .htaccess.

4. Next, you will need to create a new default .htaccess file.

5. Click New File from the main File Manager toolbar (far left-hand side).

6. Name the new file .htaccess.

7. Open the code editor and add the following code below: 

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

8. Click the Save changes button once done.

i. If the .htaccess is responsible for the error, replacing it with a generic .htaccess (code from step number 6) should bring the site back.

ii. If the site is still down after replacing the .htaccess, delete the file you created, and rename the original file back to .htaccess.


 

[Need urgent assistance with fixing WHM error? – We're available 24*7. ]


Conclusion

This article covers different ways to troubleshoot and resolve WHM / cPanel Internal server error 500.

Basically, the "Internal server error 500" message happens while accessing WHM panel or cPanel and one of the cPanel process failing to load or still running in the background.


Other causes of 500 Internal Server Error in WHM?

  • Incorrect permissions settings, usually due to having a file as "world" writeable.
  • Incorrect permissions settings for use by another script (this is common with manual installs of forums or blogs).
  • Incorrect coding in the .htaccess file.