Articles on: cPanel

My website is displaying a 500 error. How do I fix it?

A PHP 500 error, also known as an "Internal Server Error," can occur when your website encounters issues with its code or server configuration. These errors can be intermittent or persistent, and understanding their cause is key to resolving them.

Understanding PHP 500 Errors



A PHP 500 error is a generic server-side error that doesn't provide specific details, which can make it difficult to diagnose. These errors are usually related to issues in the PHP code or settings.

Intermittent Errors: These are often caused by your application hitting memory limits.
Consistent Errors: Usually indicate an issue within the application’s code, such as incorrect syntax, configuration errors, or a corrupt file.

How to Resolve Intermittent PHP 500 Errors



If the 500 error happens intermittently, your application may be reaching its memory limits. To resolve this, try increasing the PHP memory limit:

Log in to cPanel.
Navigate to Select PHP Version under the "Software" section.
Click on the Options tab.
Find the memory_limit option and increase it to a higher value (e.g., 256M or 512M).

Increasing the memory limit should be done cautiously, as setting it too high can exhaust your server’s resources.

How to Resolve Persistent PHP 500 Errors



If the 500 error persists and is not intermittent, it’s likely caused by a problem within the application’s code. To diagnose the issue:

Enable PHP Error Display:


Log in to cPanel.
Access your cPanel account using your credentials. Refer to this article: How do I log into cPanel?

Navigate to Select PHP Version.
In the cPanel dashboard, locate and click on Select PHP Version under the "Software" section.

Access PHP Options.
Once on the PHP Version page, click the Options tab.

Enable Error Display.
Scroll down to find the display_errors option and check the box next to it.

Save Your Changes.
After enabling the error display, changes should be saved automatically.

Now that PHP error reporting is enabled, visit your website again to see if any specific error messages are displayed. These messages will provide valuable information on what might be causing the 500 error. These can be script syntax issues, or issues related to website plugins/themes.

If you wish to disable error display later, simply uncheck the display_errors option and save your changes.

Check .htaccess file:


Syntax issues in your .htaccess file can cause 500 errors. Try renaming the .htaccess file to something like .htaccess_old and check if the website loads. If the site loads, the issue is likely with the .htaccess file, and you may need to review its rules for errors.

Enable WordPress Debug Mode:


For WordPress websites, you can also enable WordPress Debug Mode to provide more detailed error messages. Refer to this guide: How can I fix my WordPress website displaying a blank page?

Check PHP Version:


Ensure your hosting account is using the correct PHP version for your website. You can change your PHP version by following this guide: How do I change PHP version?

Feel free to reach out to our support team or email helpdesk@elitehost.co.za for help in diagnosing and resolving 500 errors on your website.​

Please note that resolving PHP issues falls outside the scope of our support and should be addressed by a developer. However, our team will do their best to provide guidance and assist in finding a resolution where possible.

Updated on: 24/10/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!