How to Fix “500 Internal Server Error” While Running PHP

Many website owners will have come across the “500 Internal Server Error” at some point in time. While this isn’t a very archaic error message, the more significant problem is that it may arise from many potential problems.

Thankfully, where PHP is concerned, the error is very specific – an inability to connect a request to the PHP script in question. For example, if a website visitor attempts to view a page and the connection times out, this error message will be displayed.

Resolving “500 Internal Server Error” While Running PHP

Although the root issue is known, what exactly is causing the connection to timeout can vary. Here are some of the more common methods to resolve this problem.

1. Reload or Refresh the Page

On occasion, the timeout may occur sporadically. Attempt to refresh the page a few times – if the web page can load at least once, an overloaded server likely causes the error.

Websites require resources to serve content to visitors. If your server lacks the resources to process the current volume of web traffic, you may see this error cropping up. To verify this, launch your SPanel dashboard and use the “Server Status” link to check resource usage trends.

How to Fix “500 Internal Server Error” While Running PHP, 1. Reload or Refresh the Page

If your server is consuming many resources, provisioning for more will likely resolve your 500 Internal Server Error.

2. Check File Permissions

Another possibility is that the incorrect permissions have been set on the PHP file, causing the error. Verifying this will require you to connect to your server terminal (See “Connect to my server with SSH) and check log files.

Your log files will generally be located in “/usr/local/apache/logs/error_log”

If you note messages on “SoftException in Application,” the error message is likely caused by incorrect file permission settings. To resolve this, change the permissions for the related PHP file using the File Manager tool in SPanel.

3. Check .htaccess Code

In some cases, the “500 Internal Server Error” may be caused by specific instructions set in your .htaccess file. This file provides high-level web server configurations. Both you and some web applications may amend the file, potentially causing errors.

It is advisable to move all PHP-specific instructions out of the .htaccess file and into php.ini. The php.ini file is a custom configuration file that you can build for individual applications requiring PHP to run.

Was this helpful?

What’s your goal today?

1. Find the right Managed VPS solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain

Rado
Author

Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.