How to solve The FastCGI process exited unexpectedly Error

Background

IIS with PHP is not new now days, there is lots of business needs that requires php applications need to host in IIS. Recent times PHP improved a lots in terms of integrating to IIS.Still few times few things fall apart, like the problem we are going to illustrate.

Problem

For a recent project I had to configure PHP with IIS 7.0 on Windows 2008 R2. Everything was seems fine, I even added the application pool with “No Managed Code”, configured handler mapping and sit tight to see php running,.

As soon as I hit http://localhost/phpinfo.php and boom, I see this error message.

error

 

 

Solution

After lots of googling I find the solution at last, solution was super easy, you have to install Visual C++ Redistributable for Visual Studio from here. Though it was specifically mentioned in the php download section, but I some how skipped that and wasted hours to find a solution.

Problem was PHP as FastCGI with IIS requires you to install the Non-Thread Safe (NTS) versions of PHP. And Recent releases binaries built with Visual Studio 2012 compiler , So while executing you need to have Visual C++ Redistributable for Visual Studio 2012 install in your server where you are trying to execute php scripts. And for proper installation follow these steps. Addition to these instructions you have to add an application pool with “No Managed Code” and Managed Pipeline Mode set to “Classic”. Then Go to “Advance Settings” of newly created application pool and Enable 32bit Application value to “True”

IIS deployment error There is a duplicate scriptResourceHandler section defined

Background

Few days back I was attempting to deploy a .net 3.5 website on the default app pool in IIS7 having the framework section set to 4.0, I get the following error,
There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined.

Solution

The problem occurs because when you use framework 4.0 the machine config already has some of the section defined that were used in previous asp.net versions. So replace the sectionGroup of your existing web.config with the below configs
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>

Another work around is to rebuild website/web application using framework 4, and the problem went away.

Useful IIS commands for programmers

In this short article I want to list some IIS commands that are very commonly used by developers.When needed I googled the commands each time. So intead of google each time I collected the commands and put those in same place.Some of them is listed below

Re-Register IIS

aspnet_regiis.exe -i

To restart IIS

iisreset /noforce computername

To disable restart of IIS

iisreset /disable
Create a virtual Web directory

type the following command from a command prompt:

Mkwebdir -c ComputerName -w “WebSiteName” -v DirectoryName,DriveLetter:\FolderName

Start a Virtual Site Without Interrupting the Entire Web Service

adsutil START_SERVER W3SVC/Server#

list of the other commands

  1.     chaccess
  2.     contftp
  3.     contsrv
  4.     contweb
  5.     dispnode
  6.     disptree
  7.     findweb
  8.     mkw3site
  9.     mkwebdir
  10.     pauseftp
  11.     pausesrv
  12.     pauseweb
  13.     startftp
  14.     startsrv
  15.     startweb
  16.     stopftp
  17.     stopsrv
  18.     stopweb
  19.     synciwam

To view the list of running IIS appications

iisapp