If your Internet Information Services (IIS) produces a 500 – Internal server error, your website is in serious trouble. Debugging an IIS 500 – Internal server error can take some time, so you’d better be prepared for the worst-case scenario. You don’t want to research how to deal with this error under time pressure.
Contents
- Cause of 500 – Internal server error
- Debugging an IIS 500 – Internal server error
- Resolving an IIS 500 – Internal server error
- Common 500.x substatus codes
- Author
- Recent Posts
Surender Kumar has more than twelve years of experience in server and network administration. His fields of interest are Windows Servers, Active Directory, PowerShell, web servers, networking, Linux, virtualization, and penetration testing. He loves writing for his blog.
Latest posts by Surender Kumar (see all)
- Extending LVM space in Ubuntu — Thu, Feb 2 2023
- Backup in Proxmox VE — Thu, Jan 26 2023
- Snapshots in Proxmox VE — Wed, Jan 25 2023
In my previous posts, you learned about detailed errors and failed request tracing in IIS (Internet Information Server). I recommend reading those articles first before you proceed with this one.
Cause of 500 – Internal server error
This is the most common error you will encounter with any website hosted with IIS. In most cases, a developer messed up. Thus, the fastest way is often to simply reverse the last action taken, such as restoring an earlier version of your web application. Once your system is running again, you can investigate the cause of the error on your test side in peace.
500 Internal server error
The HTTP 500 error is a server-side error. While we understand that the problem is on the server end, the error is usually ambiguous. It doesn’t exactly tell the administrator what is wrong with the server. Thus, debugging a 500 – Internal server error often takes some time.
Debugging an IIS 500 – Internal server error
Since the above error doesn’t really tell what’s actually wrong with the server, we need to enable detailed errors, as discussed in my previous post. Once detailed errors are enabled, you will see more detailed error information, including an HTTP substatus code. Sometimes even the detailed errors don’t show any useful information right away. For example, see the following screenshot:
The page cannot be displayed because an internal server error has occurred
Here I am getting: The page cannot be displayed because an internal server error has occurred. There is no HTTP status code or substatus code listed on the error page. If you get such an error even when detailed errors are enabled, right-click anywhere in the browser window and select Inspect (or press F12).
Opening developer tools in web browser to reveal server errors
This opens the developer tools in your browser window. Now, click the Console tab. The actual error thrown by the web server is displayed.
Viewing server errors using the Console tab of the web browser’s developer tools
To further understand the exact cause of 500 errors, enable Failed Request Tracing, as discussed in my previous post. Now, try to replicate the problem. If you can replicate it, open the newly generated XML log file in a web browser. The following screenshot shows the actual cause of a 500 – internal server error with a substatus code of 19 (HTTP 500.19 error):
Determining the cause of a 500 error using the Failed Request Tracing log file
Usually, substatus code 19 indicates that the configuration data is invalid. This could be due to some malformed or unidentified element in a server-level config file (ApplicationHost.config) or website-level config file (web.config). If you take a closer look at the ConfigExceptionInfo field of the log file, you will find the exact line number (6 in our case) in the web.config file that caused the exception. Now let’s take a look at the web.config file itself.
Viewing the problematic element in the web.config file
Here, you can see that the developer tried to add a mime type in the config file, but it was already defined in the server-level configuration file (i.e., ApplicationHost.config). Therefore, the Cannot add duplicate collection entry of type ‘mimeMap’ with unique key attribute ‘fileExtension’ set to ‘.mp4’ exception was returned. Furthermore, if there is some unidentified element, a syntax error, or even a typo in the web.config file, you will most likely get a similar error.
Resolving an IIS 500 – Internal server error
To resolve an IIS 500 – Internal server error, you could simply remove the line that is causing the exception. Alternatively, if you don’t want to remove this line for some reason, add the following code right above line 6 in web.config:
<remove fileExtension=".mp4" />
By doing this, you are essentially overriding the server-level element. In the end, your web.config file should look as shown below:
Overriding the server level mime element with web.config file
Now refresh the page, and the error should go away. This was just one example of resolving a 500.19 error. If you get a 500 error with a different substatus code, use the same approach to troubleshoot the problem.
Common 500.x substatus codes
The following table covers some of the most common HTTP 500 substatus codes, along with their probable causes and troubleshooting advice:
Subscribe to 4sysops newsletter!
Status Code | Probable Cause | Troubleshooting Advice |
500.11 | The application is shutting down on the web server | The application pool is shutting down. You can wait for the worker process to finish the shutdown and then try again. |
500.12 | The application is busy restarting on the web server | This is a temporary error and should go away automatically when you refresh the page. If the error persists, something is wrong with the web application itself. |
500.13 | The web server is too busy | This error indicates that the number of incoming concurrent requests exceeded the number that your IIS application can process. This could be caused when the performance settings are not right. To troubleshoot such issues, a memory dump needs to be captured and analyzed using tools such as Debug Diagnostic. |
500.15 | Direct requests for Global.asax file are not allowed | A direct request was made for the Global.asa or Global.asax file, which is not allowed by the web server |
500.19 | The configuration data is invalid | We already covered how to fix this error above |
500.21 | The module not recognized | This status code is caused by a partial installation of the IIS server, such as missing ISAPI modules. To fix this error, identify the missing IIS components and install them. |
Once you troubleshoot the problem, don’t forget to disable Failed Request Tracing and revert the detailed errors to custom errors on your web server.
500 internal server error clearly indicates that something went wrong during the display of PHP page.
By default, web servers like IIS return only generic error messages in websites. Often, this causes the masking of real reason for IIS PHP errors such as 500 internal server error.
That’s why, we frequently get request from Windows server owners to find out the reason for PHP website errors and fix them as part of our Server Management Services.
Today, we’ll take a look on how Bobcares’ Engineers track the real reason and fix php 500 internal server error in IIS.
What causes PHP 500 internal server error in IIS
Basically, 500 Internal Server Error is IIS web server’s way of saying, “Something has gone wrong when I tried to display the page. Not sure what.”
Now, its time to see the exact reasons for the 500 errors.
1. Permissions Error
From our experience in managing servers, our Windows Experts often see PHP 500 internal server errors due to wrong permissions and ownership on website files. In Windows servers, every file and every folder has its own set of permissions. Again, some permissions are inherited from the parent folders too. And, when the PHP binary do not have enough permissions to execute the scripts, it can result in 500 internal server error.
Similarly, ownership of the files also create problems. In Windows, specific users like IIS User, IIS WP User, etc. should have access on the website folders and files. For example, the IUSR account should have modify permissions on php scripts. And, when there are permission problems, website shows PHP errors.
2. Bad PHP Settings
Yet another reason for PHP internal server error is bad PHP settings. The PHP settings are specified in the configuration file at C:PHPPHP.ini. PHP binary take the values from this file while executing scripts.
A classic example will be PHP timeout settings. When the website PHP scripts has to fetch results from external resources, PHP timeout values often cause trouble. Most system administrators set timeout values in PHP to avoid abuse of the server resources. And, if the PHP script executes for a time longer than the threshold limits, it eventually results in 500 error.
3. PHP module errors
A very few 500 errors happen when the PHP module on the server as such becomes corrupt too. As a result, it results in processing failure of PHP scripts.
Luckily, when the website reports the 500 error due to module failures, IIS often show a more specific error messages like:
500.0 Module or ISAPI error occurred.
500.21 Module not recognized.
How we fixed PHP 500 internal server error in IIS
Fixing PHP 500 internal server error in IIS need a series of steps. Let’s now see how our Dedicated Engineers fixed it for one of our customers and made PHP scripts running.
The customer reported 500 internal server error on WordPress website running in IIS.
1. Turning On Display errors
While the error correctly suggested that PHP had caused 500 error code, it did not provide application-specific information about what caused the error. Therefore, the the first step of investigation was to turn ON display errors option. For this, our Dedicated Engineers followed the steps below.
- Using Windows® Explorer, browse to C:PHP and open the Php.ini file in the PHP installation directory.
- Edit and set the display_errors = On directive.
- Save the file.
- Reset IIS using the command iisreset.exe
After turning on the errors, we reloaded the PHP and it showed a PHP parse error:
Parse error: parse error in C:inetpubusersxxxhttpdocsmysiteerror.php on line 3 >>
Often browser settings only show friendly error messages. In such cases, we recommend customer to turn it Off. For example, in Internet Explorer Go to Tools, Internet Options, Advanced tab, and then clear the Show friendly HTTP error messages check box.
Thus, it was a coding error on the PHP script. We suggested script modifications to customer and that fixed the error.
2. Running PHP script locally
Yet another way to find the exact error is to run the problem php script within the server. For this, our Support Engineers connect to the server via rdesktop and execute php script using the php.exe binary. It would show the DLL’s that are having conflicts and causing the 500 error. We fix these conflicts and make the script working again.
3. Correcting PHP settings
In some cases, we need to correct the PHP settings to get the problem solved. Recently, when a customer reported problems with his website, we had to set the php directive open_basedir correctly to solve 500 Internal Server Error.
Similarly, when PHP cgi scripts show up some warning, IIS7 still displays an HTTP 500 error message. Although the best method is to fix the PHP scripts, often changing the default error handling for FastCGI in IIS7 to “IgnoreAndReturn200” also work as a temporary fix. The exact settings will look as shown.
4. Fixing PHP binary
In some rare cases, the fix may involve complete rebuilding of PHP binary on the server. This happens mainly when the PHP program on the server becomes corrupt. However, in such cases our Dedicated Engineers always check the dependency of the package and do the reinstall. For control panel specific servers, we set the appropriate binary on the server.
[Broken PHP scripts causing big problems? Our IIS experts have the fix for you.]
Conclusion
In a nutshell, PHP 500 internal server error in IIS happens mainly due to reasons like buggy PHP scripts, wrong server settings and many more. Today, we saw the top reasons for the error and how our Support Engineers fix it for customers.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
You try to load your classic ASP (Active Server Pages) website and all you can see in your browser is the all too familiar display of 500 Internal Server Error.
This page isn't working WEBSITE is currently unable to handle this request HTTP ERROR 500
What is 500 Internal Server Error
First of all, the 500 Internal Server Error is a very general HTTP status code that indicates something has gone wrong on the web server without any specifics on the exact problem.
This instruction is limited to solving a 500 error on IIS server for classic ASP websites, however some other instructions that’s related to IIS in general will help for troubleshooting IIS server for .NET applications as well.
As 500 Server Error message is very often vague, the task now is to find a more specific error message that will help us further analyze and troubleshoot the issue.
Enable Debugging and Send Errors to Browser
If the website is not in a production environment, the easiest way to do it is to enable the ASP Debugging Properties and send the errors to the browser by following these steps:
-
Launch Internet Information Services (IIS) Manager and on the left pane, select your ASP website and click on the ASP icon (Configure properties for ASP applications).
-
Under the ASP window, expand the Debugging Properties and set Enable Client-side Debugging, Enable Server-side Debugging, and Send Errors To Browser to True and click Apply.
Now, when you refresh your ASP website, you will see a more descriptive error message on your browser such as the following example:
System.Xml error '80131509' There is an error in the XML document. /itnota/failed-page.asp, line 289
With this information, you can right away open the file (e.g., itnota/failed-page.asp) and check line number 289. Again, this option is not recommended for a production website that’s still actively used and available for public since it exposes too much information publicly. The ideal way to do it is to replicate your production environment on a staging and try to reproduce the error on a lower environment.
Check IIS Log
Another way to check 500 Internal Server Error for your ASP website is by viewing IIS error logs. This is especially true if your ASP website is a public website.
Where to find the IIS Logs?
By default, the log for your website is stored on %SystemDrive%inetpublogsLogFile, but you should not use this settings for a production environment. Always set a custom path for your logs so your websites are easier to maintain in the long run. If you have a different physical hard drive for logs, even better. Make sure it’s set to Enabled.
For the sake of example, the log files are located in folder D:LogsITNota.com:
From the IIS log example below, the easiest way is to look for a pipe character (“|”) on the date and time when the error happens.
The error message can be broken down into two parts:
-
/itnota/failed-page.asp id=2087216&catId=749272
-
|289|80131509|There_is_an_error_in_the_XML_document.
The first part indicates the problematic file with its parameters which can be reconstructed by replacing the white space with a question mark (“?”) like so:
/itnota/failed-page.asp?id=2087216&catId=749272
The second part which starts with a pipe character (“|”) is the line number that caused the error, the error code, and the error description:
|289|80131509|There_is_an_error_in_the_XML_document.
From the above information, we are looking at the following information:
Item | Description |
---|---|
Filename | /itnota/failed-page.asp |
Line number | 289 |
Error code | 80131509 |
Error description | There_is_an_error_in_the_XML_document. |
Check the affected file by opening it in Visual Studio Code or any IDE.
If you use Visual Studio Code to read and write ASP or VBScript, click here for a way how to colorize your ASP code.
- Remove From My Forums
IIS7 — HTTP Error 500.0 — Internal Server Error
-
Question
-
User-471287741 posted
I am using Vista Ultimate and Visual Studio 2005 and Expression Web. I can run Hello_World.aspx and defualt.htm from both the development servers in VS and EW without issue. However, when I try to run the same files from IIS7, I receive the Server
Error below. I have setup the site as a virtual directory in IIS7, and all files are local to my C drive. What is odd to me is that iisstart.htm does work from local host without problem, so it seems that its a problem with my virtual directories.
Any help is appreciated. Thanks.Server Error
HTTP Error 500.0 — Internal Server Error
Description: The page cannot be displayed because an internal server error has occurred.
Error Code: 0x80070005
Notification: BeginRequest
Module: IIS Web Core
Requested URL: http://localhost:80/ExpressionTest/default.htm
Physical Path: C:UsersPhillip_DevelopementVisual Studio 2005WebSitesExpressionTestdefault.htm
Logon User: Not yet determined
Logon Method: Not yet determined
Handler: Not yet determined
Most likely causes:
- IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
- IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
- IIS was not able to process configuration for the Web site or application.
- The authenticated user does not have permission to use this DLL.
- The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
What you can try:
- Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server’s machine account.
- Check the event logs to see if any additional information was logged.
- Verify the permissions for the DLL.
- Install the .NET Extensibility feature if the request is mapped to a managed handler.
- Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click
here.
More Information…
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
Microsoft Knowledge Base Articles:
- 294807
Server Version Information: Internet Information Services 7.0.
Answers
-
User-471287741 posted
Seem to have solved my issue with the following:
1. Removed IIS and WAS. Re-installed with the following settings:
Web Management Tools (default) — IIS Management Console
WWW Services — Application Development Features — ALL
— Common Http Features — ALL
— Health and Diagnostics — ALL
— Performance Tracing — ALL
— Security (default) — Request Filtering
2. Add «Users» to folder security options for each folder being added as a virtual directory in IIS7
Worked!!!!
I got the suggestion from the following
blog
Additional Question: Any suggestions on these IIS7 settings, or are the above settings OK for dev purposes? Thanks.
-
Marked as answer by
Tuesday, September 28, 2021 12:00 AM
-
Marked as answer by
Мы описывали как настраивать веб-публикацию на IIS в инструкции.
Но после настройки веб-публикации при подключении к базе может возникать ошибка “Ошибка HTTP 500.0 — Internal Server Error”.
Если модуль был установлен с 32-битного клиента, то требуется это указать в пуле приложений. Для этого мы делаем следующую настройку:
- Заходим в Панель управления → Администрирование → Диспетчер служб IIS.
- Выбираем Пулы приложения которые задействованы в веб-публикации, в нашем случае DefaultAppPool.
- Нажимаем ПКМ Дополнительные параметры.
- В строке Разрешены 32-разрядные приложения мы указываем True как на Рисунке 1.
- Нажимаем ОК.
Рисунок 1 — Дополнительные параметры пула приложений
Если не сработало, есть следующие возможные решения:
- Убедитесь, что разрешения NTFS для файла web.config верны и обеспечивают доступ к учетной записи компьютера веб-сервера. Заходим в директорию, где размещена публикация (по умолчанию — C:inetpubwwwrootИМЯ_БАЗЫ). Нажимаем ПКМ на web.config → Свойства → Безопасность. Убедитесь в том, что у группы IIS_USERS есть права на чтение, выполнение, запись и изменение файла. Если нет — нажмите кнопку Изменить, в появившемся окне Добавить → Дополнительно и найдите в списке IIS_USERS. Добавьте эту группу и назначьте соответствующие права.
- Проверьте журналы событий, чтобы посмотреть, была ли зафиксирована какая-либо дополнительная информация. Открываем Выполнить (ПКМ на кнопку меню пуск или сочетанием клавиш Win+R), вводим “eventvwr.msc”, нажимаем Enter. Возможно, журнал даст подсказку какой компонент может сбоить.
- Переустановите компонент IIS на сервере. В диспетчере серверов удалите роль Веб-сервера IIS, перезагрузите сервер, а затем установите заново через оснастку Добавить роли и компоненты.
- Установите компонент расширения .NET, если запрос сопоставлен управляемому обработчику.
В Windows Server 2012 и младше: заходим в Диспетчер серверов → Добавить роли и компоненты → Роли сервера → Веб-сервер (IIS) → Веб-сервер → Разработка приложений → Расширяемость .NET. Далее идём далее по указаниям системы.
После применения настроек, мы можем подключаться к настроенной веб-публикации без ошибок.
Нужна готовая настройка веб-доступа к 1С? Попробуйте наш сервер 1С в аренду, в услугу включены все настройки и обслуживание.
-
+1 888 500 1070 (Toll Free)
-
+1 888 500 1070 (Toll Free)
- Product
Unique Public & Private Cloud Management Portal for Data centers, Enterprise & Webhosting Companies.
Easy-to-use self-service portal allows your customers the freedom to manage their cloud with minimal handholding.
Self-service portal allows businesses to manage their resources, monitoring & vulnerability scan, by themselves.
Centralized governance and secure and holistic management of resources across multiple clouds through RBAC.
- Cloud services & AIOps
PUBLIC CLOUD
Transform Your Enterprise on AWS Cloud Platform with Cost-Effective, AIOps-Driven Managed Offerings.
GCP
Assistanz helps Enterpise, drive innovation, manage costs, governance and risks associated with their workloads on Google Cloud Platform.
CONTAINER ORCHESTRATION
Orchestrate containerized applications across multiple environments with end-to-end support from certified Kubernetes administrators.
Helps organizations increase efficiency, reduce cost and speed up time to market through pipeline automation across different cloud platforms.
PRIVATE CLOUD
Assistanz are the largest supporter of CloudStack since 2015, specializing in design & implementation of laaS for private & public clouds.
- Support Services
Our IMS Plans cover IT infrastructure planning, design, implementation, maintenance and evloution
If you are looking for staffs who could augment your webhosting business, then Assistanz is just the partner you’re looking for.
Offload your cPanel Server management & support overheads and focus only on your business.
A fully comprehensive plan to manage your Linux & Windows Plesk Servers.
Our DirectAdmin server management plan provides you with unlimited hours of server.
Enable easy migration of applications to cloud with our robust cloud server migration services.
Connect with US
Looking for more cutomized support solutions ?
Our team is ready to help you
Explore our free Configuration package, Scripts, Automations & More..
Quality Management System
- Company
Established in 2004, Assistanz has become one of the most preferred IT Service providers across diverse industry segments and a complete one-stop shop for all your IT Needs & Solutions.
Questions about our service?
Our team can answer them for your within a day..If you care for a career…
- Blog
- Product
Unique Public & Private Cloud Management Portal for Data centers, Enterprise & Webhosting Companies.
Easy-to-use self-service portal allows your customers the freedom to manage their cloud with minimal handholding.
Self-service portal allows businesses to manage their resources, monitoring & vulnerability scan, by themselves.
Centralized governance and secure and holistic management of resources across multiple clouds through RBAC.
- Cloud services & AIOps
PUBLIC CLOUD
Transform Your Enterprise on AWS Cloud Platform with Cost-Effective, AIOps-Driven Managed Offerings.
GCP
Assistanz helps Enterpise, drive innovation, manage costs, governance and risks associated with their workloads on Google Cloud Platform.
CONTAINER ORCHESTRATION
Orchestrate containerized applications across multiple environments with end-to-end support from certified Kubernetes administrators.
Helps organizations increase efficiency, reduce cost and speed up time to market through pipeline automation across different cloud platforms.
PRIVATE CLOUD
Assistanz are the largest supporter of CloudStack since 2015, specializing in design & implementation of laaS for private & public clouds.
- Support Services
Our IMS Plans cover IT infrastructure planning, design, implementation, maintenance and evloution
If you are looking for staffs who could augment your webhosting business, then Assistanz is just the partner you’re looking for.
Offload your cPanel Server management & support overheads and focus only on your business.
A fully comprehensive plan to manage your Linux & Windows Plesk Servers.
Our DirectAdmin server management plan provides you with unlimited hours of server.
Enable easy migration of applications to cloud with our robust cloud server migration services.
Connect with US
Looking for more cutomized support solutions ?
Our team is ready to help you
Explore our free Configuration package, Scripts, Automations & More..
Quality Management System
- Company
Established in 2004, Assistanz has become one of the most preferred IT Service providers across diverse industry segments and a complete one-stop shop for all your IT Needs & Solutions.
Questions about our service?
Our team can answer them for your within a day..If you care for a career…
- Blog
-
Blog, Technologies
-
Loges -
September 30, 2017
Steps to Resolve 500 Internal Server Error for PHP in IIS on Windows 2016
In this blog, we will show you the steps to resolve 500 Internal Server Error for PHP in IIS on Windows 2016.
ACCESSING PHP INFO PAGE
- To troubleshoot this issue, place a phpinfo page under your website home folder.
<?php phpinfo(); ?>
- Open the web browser and access the URL http://localhost/phpinfo.php and if you see the 500 Internal Server Error. Follow the below steps.
VERIFY THE IIS HANDLER MAPPING
- Make sure that PHP was configured correctly in IIS.
- Open IIS snap-in and click on the server name.
- Double click on Handler Mappings icon.
- You can see the list of handlers configured in that server. Double click on the PHP handler.
- Make sure that php-cgi.exe was added as executable in IIS.
VERIFYING PHP MODULES
- Open the command prompt and go-to PHP binary folder. In this demo, it is C:program filesphp 7.1 folder.
- Type the below command to view the available modules in the PHP.
php –m
- If PHP dependencies are installed correctly it will show the list of available modules in PHP or it will show the error like below.
- It looks like Visual C++ is missing on the server. Google the VC++ and install it.
- Browse the below URL and download the Microsoft Visual C++ 2015 Redistributable Update 3 RC package.
https://www.microsoft.com/en-us/download/details.aspx?id=52685
- Click on Download and select vc_redist.x86.exe and click Next.
- Once the download is complete, double-click on the vc_redist.x86.exe file. Accept the License Agreement and click on Install button.
- Once the installation is successful click on close button.
- Verify the PHP modules from the command prompt again. Now you will able to see the list of modules available in PHP.
- Browse the info page again and you will able to see the PHP configuration information.
- So, PHP requires MSVC++ as a compiler to execute the coding.
VIDEO
Thanks for reading this blog. We hope it was useful for you to learn to resolve the PHP 500 internal server error in IIS
Loges
Most Popular: