An "Internal Server Error" on a Web Hosting instance

更新时间:
复制 MD 格式

This topic describes the causes and solutions for an "Internal Server Error" on a Web Hosting instance.

Problem description

  • For a Web Hosting instance running a Linux operating system: When you access a website on the instance, an "Internal Server Error" message appears. The error message is similar to the following:

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, *** and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    More information about this error may be available in the server error log. 
    Note

    This error can also occur if you modify theme variables for a WordPress site installed on a Web Hosting instance running a Linux operating system.

  • For a Web Hosting instance running a Windows operating system: When you access a website on the instance, an "Internal Server Error" message appears. The following are common examples:

    • Issue 1: HTTP Error 500.19 - Internal Server Error. The error code is 0x800700b7. The configuration error message is "a duplicate system.web.extensions/scripting/scriptResourceHandler section is defined". The duplicate configuration item that causes the error is <section name="scriptResourceHandler" />. The relevant configuration source snippet is as follows:

      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
          <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

    • Issue 2: An "HTTP Error 500.0 - Internal Server Error" message appears.

      Error Summary
      HTTP Error 500.0 - Internal Server Error
      Cannot find the <handler> scriptProcessor in the <fastCGI> application configuration.
      
      Detailed Error Information
      Module   FastCgiModule
      Notification   ExecuteRequestHandler
    • Issue 3: An "HTTP Error 500.22 - Internal Server Error" message appears.

      Server Error in Application "xxx"
      
      HTTP Error 500.22 - Internal Server Error
      An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
      
      Detailed Error Information
      Module ConfigurationValidationModule          Requested URL http://xxx:80/
      Notification BeginRequest                            Physical Path f:\xxx
      Handler StaticFile                           Logon Method Not yet determined
      Error Code 0x80070032                           Logon User Not yet determined

Causes

Solutions

Find the relevant cause and apply the corresponding solution.

Incorrect code in the .htaccess file

The .htaccess file

  • The .htaccess file is a configuration file on standard Web Hosting instances running a Linux operating system. It controls webpage configurations for its directory and subdirectories.

  • Use the .htaccess file to configure 301 redirects, create custom 404 error pages, change file extensions, control user access, disable directory listing, and set default documents.

  • The name of the .htaccess file starts with a period (.). On Linux operating systems, this makes it a hidden file. You can use an FTP tool to show hidden files. For more information, see Hidden files are not displayed in the FTP file list.

Solution

If you add code to the .htaccess file that conflicts with the source files, an error may occur when you access the website. To fix this, back up the .htaccess file from the instance (for example, by downloading it to your computer), delete the original file from the instance, and then try to access your website again. For more information, see Manage files by using File Manager.

Incorrect file permission

The default permission for directories and files is 755, whereas the permission for resources such as images, text, and other HTML files should be 644. If a 500 error occurs after you upload a file, check its permissions. Use an FTP client to modify file permissions. For more information, see Modify file permissions for your website application.

Incorrect PHP file configuration

This section uses a WordPress site as an example. If an "Internal Server Error" occurs when you access the website, follow these steps to resolve the issue.

  1. Back up the ./wp-includes/class-http.php file.

  2. Modify the following content in the ./wp-includes/class-http.php file.

    • Before modification:

    $request_order = apply_filters('http_api_transports', array('curl','streams'),$args,$url);
    • After modification:

    $request_order = apply_filters('http_api_transports',array('streams'),$args,$url);
  3. Upload the updated ./wp-includes/class-http.php file to the wp-includes directory.

  4. Access your WordPress site again to confirm that the issue is resolved.

Outdated PHP version

An "Internal Server Error" on a WordPress site, which can occur after database configuration or theme modification, is often caused by an outdated PHP version. Follow these steps to resolve this issue.

  1. Log on to the Cloud Web Hosting management page.
  2. Find the Cloud Web Hosting instance you want to manage and click Manage in the Actions column.
  3. In the left-side navigation pane, choose Advanced Environment Settings>PHP Version Settings.

  4. Check if the PHP version meets your application's requirements.

    If the PHP version is too low, select a higher version, click Save Settings, and then click Confirm.

  5. Verify that you can access your WordPress site and modify its theme.

Server resource overload

Server resource overload occurs when multiple processes compete for CPU resources. To resolve issues caused by high CPU utilization, see the following topics:

.NET Framework version mismatch

If your website is based on ASP.NET, resolve this issue by changing the .NET Framework version on your instance to match the version required by your application.

  1. Log on to the Cloud Web Hosting management page.
  2. Find the Cloud Web Hosting instance you want to manage and click Manage in the Actions column.
  3. In the left-side navigation pane, choose Advanced Environment Settings>.NET Version Settings.

  4. Check if the .NET Framework version meets your application's requirements.

    If the versions do not match, select the correct version, click Save Settings, and then click Confirm.

  5. Wait for the changes to take effect and then confirm you can access your website.

PHP not supported in the Windows environment

An application designed for an Apache server in a Linux environment may fail after migration to an instance running a Windows operating system. This issue occurs because the Windows environment does not support PHP-based websites. You can use one of the following solutions:

  • Change the instance's operating system to a Linux version that meets your PHP website's configuration requirements. For more information, see Change the operating system of an instance.

  • Upload a complete ASP-based website application to the Web Hosting instance.

Note

Your application developer must provide the complete ASP website application code.

IIS application pool not in classic mode

In the Web Hosting console, you can set the Internet Information Services (IIS) application pool to use classic mode. Follow these steps:

  1. Log on to the Cloud Web Hosting management page.
  2. Find the Cloud Web Hosting instance you want to manage and click Manage in the Actions column.
  3. In the left-side navigation pane, choose Advanced Environment Settings>.NET Version Settings.

  4. Select a .NET Framework version that runs in classic mode, click Save Settings, and then click Confirm.

  5. Wait for the changes to take effect and then confirm you can access your website.