A 500 Internal Server Error is possibly the most irritating error that you will experience. In many cases, it is possible to resolve this issue by following the procedure described in this document.
In the 500 Internal Server Error scenario in which the server is experiencing an unanticipated issue that stops it from completing the client request. It is important to note that there’s nothing problem with the server. It’s simply running into an issue that it isn’t able to resolve.
Before making any changes to the code of the website and database, it’s recommended to create a copy of your server in order that you can restore your website in the event that something goes wrong.
The solution to the 500 Internal Server Errors is a matter of following this procedure:
How to Solve 500 Server Internal Error
First Step: Identifying the issue
It is the first thing to understand the nature of the issue and attempt to comprehend the error. To do the purpose, you need to look through PHP logs (part of Apache error logs) for more information on the error.
If you’re unable to locate the error logs in the index.php file Try enabling PHP errors by adding these paragraphs to the index.php file:
ini_set(‘display_errors’, 1); ini_set(‘display_startup_errors’, 1); error_reporting(E_ALL);
If you own a WordPress website then take a look at the wp-config.php file (located in the root directory of the website) by SFTP then open the file with your text editor of choice. Find the string ” WP_DEBUG’. If you come across the line, just change the value from FALSE in to True then upload your file once more.
The line may not be present in the configuration file then add an additional line to this file: wp-config.php file:
definition( “WP_DEBUG” True );
Reload the site and check whether the error is corrected.
If it is, and you are now seeing a fatal error message that identifies the code line within a particular file, you’re dealing with a basic code fault. Assuming the error is caused by the theme or plugin and you’re required to turn off the offending software or fix the issue by yourself (or ask someone else to examine the issue if you’re unable to figure out the cause by yourself).
If you’ve found the issue, be sure to change the previously mentioned ‘ TRUE’ value in ‘ FALSE’ in the wp-config.php file.
Second Step: Clear .htaccess File
A non-existent .htaccess file can also trigger the error to appear on internal pages. Thus, include the following rules to the .htaccess files through remotely connecting your web server via SSH/SFTP.
# BEGIN WordPressRewriteEngine On RewriteRule . * – [E=HTTP_AUTHORIZATION:%] RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond % !-f RewriteCond % !-d RewriteRule . /index.php [L# End WordPress
3. Troubleshoot .htaccess Issues
In many instances, rules within the .htaccess file can also trigger a 500 Internal Server Error. It is usually caused by rules that reference modules that aren’t installed or available on the Apache server.
Another possibility is Recursive rewrite rules which could result in an Internal 500 Server error.
4. Increase Memory of PHP Limit
PHP libraries need an amount of memory for the success of PHP scripts. Increasing the available PHP memory limit in tabs Server and Packages Server and Packages tabs will also resolve this 500 Internal Server error. If you’ve set an amount of memory in your application configuration files, you can raise the amount in these files. Modifying this PHP memory limit can aid in avoiding this “Allowed capacity of memory” error.
5. Determine whether the Admin works
Log in to the admin panel of your site. If this page loads properly and allows you to log in, you can be reasonably sure that the issue is with a plugin/extension/module or with the active theme. In the event that the administration page loads, go to step 4.
Step 6 Revert Recent Modifications
If your development team made changes before the 500 error was first reported it is recommended to restore to the previous version available. In this way, you can identify the likely cause that caused the issue.
It is an excellent practice to test changes on a staging site or environment to ensure that everything is working exactly as you intended. To aid our customers with this, Cloudways Staging is a feature that allows users to test their website’s changes. Cloudways Staging feature offers the ability to create dedicated and unlimited staging websites which allow users to check the changes on a website before transferring codes to servers that live.
Step 7: Audit Your Plugins/Extensions/Modules
Plugins/extensions/modules can also cause 500 Internal Server Errors. In general, the error occurs because of the compatibility issues caused by outdated plugins/extensions/modules or poorly coded new ones.
To find out which of your plugins/extensions/modules is causing the error, deactivate ALL of them and then reactivate them one at a time. If you are using WordPress, Magento, and similar applications, utilize the app Dashboard, CLI, or SFTP.
If you find the infringing extension or plugin, remove it (or better yet, remove) it, and then contact the developer to get assistance.
Step 8: Verify Permissions for Files
If neither of the suggestions above is working, the problem could be with permissions for files. Fortunately, the solution is quite simple: press”Reset Permissions.”.
That’s it! We hope that this article has been helpful. If you require any assistance or assistance, please look up your question on the Cloudways Support Center or reach us via chat (Need Help? Send us a message). Alternately, you can make an online help ticket.