php-cgi.exe - The FastCGI process exited unexpectedly error and how to fix it

php-cgi.exe - The FastCGI process exited unexpectedly error and how to fix it

You just installed your brand-new Windows 2012 RC2 Server and you want to setup the PHP framework aswell. You launch the Windows Web Platform and download the latest PHP version (let's say v5.6.0) and set up php.ini and all the relevant configuration files. Then, as soon as you launch the website, you get the following error:

Despite this being a fair common issue, there aren't many posts explaining how to fix the problem yet. Well, here's one.

Solution

The fix is really simple: you just need to install Visual C++ Redistributable for Visual Studio 2012 Update 4, 32-bit version. Notice that, even if you have a 64-bit operating system, you need to install the 32-bit version because PHP is still a 32-bit application.

Here's the download link: http://www.microsoft.com/en-us/download/details.aspx?id=30679

Once you install that, you'll be good to go.

UPDATE: Since the launch of the x64, experimental version of PHP 5.6 (and above) this post requires the following update: if you're using an 64-bit PHP build, you have to install the 64-bit Visual C++ package, available through the same download link mentioned above. As the two packages can coexist without hassles, our suggestion for 64-bit based installations is to install both as long as x64 PHP builds will be marked as "experimental", so you'll be able to switch back to the x86 version whenever you need to.

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

11 Comments on “php-cgi.exe - The FastCGI process exited unexpectedly error and how to fix it”

  1. Thanks for the solutions, came across ur post after hours of searching. Its sad that theres not much info online about this issue.

  2. I tried the install of PHP 7.0.9 on Win 2012 R2 SP1 with VC++ Redist versions 2010,2012 and 2015 x64 and x86 and I still get a HTTP500 error.

    I double check the handler mappings, security on the file and PHP directory. At my wits end.

    Here is the code I am trying to run

    “accessstat”,
    ‘UID’=>’accessstat’,
    ‘PWD’=>’accessstat’);
    $conn = sqlsrv_connect( $serverName, $connectionInfo );
    if( $conn === false ) {
    die( print_r( sqlsrv_errors(), true));
    }

    $sql = ” Select COUNT (*) FROM [accessstat].[dbo].[Usage_Detail]

    $stmt = sqlsrv_query($conn, $sql );
    if( $stmt === false)
    {
    die(print_r(sqlsrv_errors(), true));
    }

    if(sqlsrv_has_rows($stmt))
    {
    print(“”);
    print(“collectiontime”);
    print(“Usercount”);

    while($row = sqlsrv_fetch_array($stmt))
    {
    $regdate = date_format($row[‘collectiontime’], ‘m-d-Y’);
    print(“”.$row[‘Usercount’].””);
    }
    print(“”);
    }
    ?>
    Any and all help appreciated

    1. The top part of this got cut off

      “accessstat”,
      ‘UID’=>’accessstat’,
      ‘PWD’=>’accessstat’);
      $conn = sqlsrv_connect( $serverName, $connectionInfo );
      if( $conn === false ) {
      die( print_r( sqlsrv_errors(), true));
      }

      $sql = ” Select COUNT (*) FROM [accessstat].[dbo].[Usage_Detail]

      $stmt = sqlsrv_query($conn, $sql );
      if( $stmt === false)
      {
      die(print_r(sqlsrv_errors(), true));
      }

      if(sqlsrv_has_rows($stmt))
      {
      print(“”);
      print(“collectiontime”);
      print(“Usercount”);

      while($row = sqlsrv_fetch_array($stmt))
      {
      $regdate = date_format($row[‘collectiontime’], ‘m-d-Y’);
      print(“”.$row[‘Usercount’].””);
      }
      print(“”);

      }

      ?>

      1. Thanks man I’ve looked all over for this.. deleted and installed the stuff like 5 times.. never did it say that in the configs…

        Works great

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.