locked
Fix for PHP 5.3 IIS 7 500 Internal Server Error The FastCGI process exited unexpectedly RRS feed

  • Question

  • User-362908754 posted

    This post is to help anyone who is having 500 Internal Server Errors with their install of PHP 5.3 on IIS 7 in the Windows 2008 Server environment. I just spent a few hours troubleshooting this and I hope I can help save more hours of the same for others. I looked this up and found a lot of false leads then I came up with a solution which fixes this for me on my server, so I'll list it all here and hopefully people can add to it if I miss anything. Also if my fix falls apart after a while I can post it back here and see if we can all go back and review the steps and at least have a list of what works and what doesn't work.

    So this is how it started for me: I just installed PHP 5.3 on my production server Windows 2008 32-bit, I got the download msi installer from http://windows.php.net/download/ the VC9 Non-Thread safe version.

    I set everything up with the php.ini fine and it worked fine. But after about an hour using WordPress 2.8.2 I kept getting 500 Internal Server Errors and the detailed description from the server Browser says:

    The FastCGI process exited unexpectedly

    Module FastCgiModule
    Notification ExecuteRequestHandler
    Handler PHP_via_FastCGI
    Error Code 0xc0000005

    I tried all the usual fixes, I set the error_reporting = E_ALL & ~E_DEPRECATED

    I also set the date.timezone ="America/Los_Angeles" - don't know if the quotes matter

    I also read that setting Write permission for the Anonymous Identity on the wp-content folder fixed this issue but I did that and it does not fix the issue.

    Ironically I was doing all of this while creating a write up to install PHP 5.3 on the IIS 7 Windows 2008 Server Platform so I was testing it out on my server as I wrote it.

    I followed my instructions and it worked fine but then about every three clicks I got the 500 Internal Server Error.

    The odd thing is that if I click the refresh button the page pops up fine without any error, then I can go on for about three or so clicks and I'll get the 500 Internal Error again. Same thing on the Server with the detailed error page, if I click refresh then it's fine for a few more clicks then it happens again.

    Then finally I removed the open_basedir = directive for each of my custom PHP web site paths and it worked fine with no more 500 Internal Server Error, and that is what I can report is the fix.

    My next guess would have been giving more Memory than the 16 MB allotted via the "more secure" php settings.

    There was some fussing around with the Server Handler Mapping and having quotes on it for the Program Files section of the file path to the php-cgi.exe and I set the FastCGI Module to check for the php being a "File or Folder" in the FastCGI settings so I don't know if this helps but just to be complete with my steps I'm including it.

    Getting rid of the open_basedir did it for me though, so I hope that helps. If people have issues and want to list what they did or are doing to fix it and if any of what is listed here helps please post a reply and I'll try to keep up with it as much as I can.

    Oh and my last point, I was going to stop troubleshooting this, I have a lot of work to do and I was well beyond the "screw it" point, but being a programmer you know that you just can't walk away when the little bugger machines start acting up.

    I was about to uninstall PHP 5.3 and go back to what worked - PHP 5.2.9 - but I'm glad I stuck it through, the speed and enhancements from PHP 5.3 are noticeable. If you are frustrated with this, just stick through with this guide and see if we can get others to add to it and have a comprehensive list of issues and fixes for it, PHP 5.3 is really nice and well worth it. After looking at all the Bug reports and angry posts online about PHP 5.3 I just want to get it across that the improvements are worth fixing what ever is bugging the "New" "Just Released" thing, this is the typical hair pulling that comes with the bleeding edge latest and greatest early adopter crowd of anything.

    Thanks.

    Sunday, July 26, 2009 10:20 PM

All replies

  • User-1806442060 posted

     I am getting error code of 0x000000ff.

    Is it because that I have installed threaded version instead of Non-threaded version?

    Monday, August 10, 2009 11:31 AM
  • User-362908754 posted

     I think that may be the case, set up the non-threaded one and see what happens.

    Monday, August 10, 2009 4:20 PM
  • User-1806442060 posted

     I changed to non-threaded version. It is still throwing error. can't trace the issue. I am using W2k8 64bit. do I have to run script for 32bit?

    Monday, August 10, 2009 6:04 PM
  • User-362908754 posted

     Yes do that, I've seen some posts talking about 64-bit also make a list of all the steps you are taking in your PHP install, did you completely uninstall a previous version of PHP?

    Monday, August 10, 2009 10:16 PM
  • User-362908754 posted

     Did you fix your PHP 5.3 issue on Windows 2008 server on 64-bit?

    Tuesday, August 25, 2009 2:40 AM
  • User-1636650102 posted

     I too am getting this error runing windows iis7.0 on 64bbit tried the fix but still get the error

    Monday, September 28, 2009 3:10 AM
  • User-1405480850 posted

    Hi Halinab,

    500 is an internal server error and the message implies that FastCGI called something like ExitProcess. There can be many reasons for this. Can you tell more details please. Specifically I would like to know:

    • From where and how did you install PHP 5.3?
    • Did you configure FastCGI properly?
    • Did you ever install PHP on this machine? If yes, how and if this was using FastCGI or ISAPI?

    I would advise if you have to setup PHP environement the best bet will be to use Microsoft Web Platform Installer which can be found at http://www.microsoft.com/web/downloads/platform.aspx. It is simple to use and takes care of installing all the dependencies.

    Thanks,

    Don.

    Monday, September 28, 2009 10:14 AM
  • User-1405480850 posted

    One more thing I forgot to add. Microsoft Web Product Installer will install PHP5.2.11. However this will ensure that your other environment and depencies are installed correctly. Once you have 5.2.11 running let me know, I will tell you how to upgrade to 5.3. Currently WEBPI doesn't offer 5.3.

    Thanks,

    Don.

    Monday, September 28, 2009 10:19 AM
  • User-1988189302 posted

     Hi,

     i´ve installed Php 5.2.11 using WEB PI. Now, how do i updrade to Php 5.3 ?

     

    thx André

    Monday, February 8, 2010 10:42 AM
  • User-1405480850 posted

    Please follow my blog at http://blogs.iis.net/donraman/archive/2009/10/08/upgrading-to-php-5-3-an-easy-way.aspx.

    Thanks,

    Don.

    Monday, February 8, 2010 11:00 AM
  • User-362908754 posted

    Also check out this tutorial if you run into trouble, it lists the steps of the manual install of PHP 5.3 on a Windows 2008 IIS 7 environment so you know where to look if something goes wrong and how to walk through each step and find out where the PHP components are in the Windows 2008 operating system and web server - How to install PHP 5.3 on the IIS Windows 2008 Server Platform - if you find anything missing please add it to the comments and it'll be added to the tutorial, it's an on going log and guide for people to use and make better with their own PHP 5.3 on Windows Web Server 2008 install experience. 

    Monday, February 8, 2010 4:21 PM
  • User778831628 posted
    anyone have a solution, i've tried everything above and nothing works, Windows Server 2008 x64 with x32 php nts 5.3.2 and wordpress 2.9.2 it works fine, but in fastcgi mode borks out after 2-3 page loads, i have log_errors on and error_log set, but i dont see anything logged their except from anohter site that had a legitimate error. really need to get this working (oddly in f-cgi mode, its fast and wincache1.1 works, but it crashes, but in cgi mode, it doesnt crash, wincache reports no saved files or caching, and its slower)
    Tuesday, March 16, 2010 11:25 PM
  • User-1405480850 posted

    Hi,

    Please let us know details about how are you concluding that Wordpress is crashing in FastCGI mode and please share details about the crash. You can use ADPLUS as described at http://support.microsoft.com/kb/286350 to troubleshoot hangs and crashes further.

    Thanks,

    Don. 

    Wednesday, March 17, 2010 2:20 AM
  • User189021270 posted

     I had a problem with php 5.3.2 and iis7 on windows server 2008 32-bit (on vmware vm) and mysql 5.? and Wordpress 2.9.2.  I've had the vm working fine for over a year, with a previous version of wordpress and php, and also using imagick, joomla, and my own dynamic websites.

     I couldn't install at all - getting 500 error, no php errors in the php error log, and a failed request trace saying about a FCGI process that exited normally.

     Turned-out I spelled the name of my mysql database incorrectly!  Weird how it resulted in such an error though?

    ---

    I'm saying this, because I wonder if intermittent errors could be to do with script-timeouts vs database response time-outs etc?  Incidentally I've had problems with openbasedir not doing expected things in the past too - I've had to change my design to accomodate it though I've always needed it as my application pools use user accounts and so I need to be able to use those user-account temporary-file locations preferably. And I like to isolate sites and access to them.  Also I had previously come accross a problem with using "localhost" in a database connector for mysqli after upgrading to php5.3.2 - something to do with localhost resulting in getting the (first) IPV6 address rather than the IPV4 one (part of a mysql process?) from the windows hosts file.  I had to change to 127.0.0.1

     ---

    Don't know if my blunderings/observations are of any help to anyone.

    Monday, April 12, 2010 2:46 AM
  • User655047365 posted

    From experience here's what i've found out :

     

     IIS will return a generic Internal Server Error 500 if it doesn't have any more specific error from the application, in this case PHP/FastCGI.

    To provide IIS with all necessary php error information and NOT display the generic Internal Server Error, do the following to your php.ini file:

     

    log_errors = off

    To ensure PHP error messages do make it to the web page do this:

    display_errors = on

    The level of PHP error reporting can be controlled by (more about this at http://php.net/error-reporting ):

    error_reporting = E_ALL & ~E_NOTICE

     

    From all of this we can now easily understand how a simple date.timezone unset parameter can end up as an Inernal Server Error 500 on a web page. Normally if you don't set this parameter, PHP would want to report:

    Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for '-7.0/DST' instead in C:\inetpub\wwwroot\info.php on line 3

    and since it could not report it (because of log_errors = on) IIS has instead returned the generic Internal Server Error message.

     

    Therefore in summary:

     

    • log_errors = off
      • on = internal server error 500
      • off = detailed php error message to the web page (provided display_errors = on)
    • display_errors = on
      • on = error goes to STDOUT, which makes it to the webpage (provided  log_errors = off)
      • off =
        • either a) nice blank page if php encountered a fatal error on the page and could not form any html. 
        • OR b) the page loads and no php error shows , although underneath an error did in fact occur, it's just not being reported to STDOUT, which is the web page.
    • error_reporting
      • controls the level of php error reporting.

     

    I hope this helps somebody.Cheers!

    Tuesday, May 25, 2010 3:36 AM
  • User-1405480850 posted

    Hi,

    Turning display_errors to On seems like a good idea on a development server. But turning this directive 'On' on a production server can expose some error messages to the client which may be dangerous.

    I believe the best way is to configure below directives in php.ini.

    display_errors=Off
    log_errors=On
    error_log="C:\WINDOWS\Temp\php-error.log"

    error_reporting can be kept to E_ALL or whatever one wants. Also ensure that your web server has sufficient permission to write to the file specified by error_log INI directive.

    This will ensure that whenever there is a PHP error it gets logged into the file pointed by error_log at the server side and so only administrator has access to it.

    All this suggested settings are automatically done by installing PHP from Microsoft Web platform Installer. Unfortunately WPI doesn't support PHP5.3 (but supports installation of PHP5.2.13 as of now) but we are working on it.

    Thanks,

    Don.

    Tuesday, May 25, 2010 11:30 AM
  • User901002430 posted

    Hello,

    Locally i have a Windows Web Server 2008 machine on which I have installed IIS7, PHP5.3, etc (using Windows Web Platform Installer – http://www.microsoft.com/web/downloads/platform.aspx). When I test a PHP file in which there is only phpinfo() it works fine. When I try to include files from within my php files (using include(), require(), etc), I get the HTTP 500 Internal error. After trying several recommendations from forums (like this one), i’ve find a solution.

    I’ve downloaded PHP5.3.5 from http://www.blumentals.net/download/php.php and replaced the contents of the existing PHP (installed using Windows Web Platform Installer) with this one. Problem solved.

    nadim attari
    alienworkers.com

    Wednesday, March 9, 2011 4:38 AM
  • User-1672167363 posted

    Hello,

    The PHP 5.3.5 version listed and IIS 7 Server.

    Please update to a more recent version PHP 5.3.9 release install http://forums.iis.net/t/1186168.aspx information.

    Regards,

    Martin

     

    Monday, January 30, 2012 9:26 AM
  • User-568561056 posted

    Thanks for the post - helped alot!

    I just wanted to add one additional note here for those trying to get PHP to run on Server 2008 R2 (64bit) - make sure you install the 32bit version of the Microsoft Visual 2008 C++ Runtime.  We tried it with the 64bit version of the Runtime, and still got 500 errors.  The 32bit version of this solved our issues.

    Wednesday, March 7, 2012 9:04 AM
  • User-829229747 posted

     Upon installing the PHP 5.3, I did not realize that my run-time version for Visual C++ was the 64bit version. I installed the 32 bit version and the problem is fixed!!! This... along with the steps from the PHP.net "Manual Install Steps" were followed exactly as documented and PHP runs fine.

    Wednesday, March 7, 2012 9:08 AM
  • User-220246196 posted
    Did you uninstall Visual C++ 64 bit before installing the 32 bit version?
    Friday, March 23, 2012 4:53 PM
  • User-568561056 posted

     I installed the 32 bit in addition to keeping the 64 bit intact and all seems to work fine

    Tuesday, March 27, 2012 11:32 AM
  • User588781394 posted
    The error 500 error code was corrected when I turned off error logging. log_errors = off other settings related to this are: error_reporting = E_ALL display_errors = On Also, I dropped to the command line and executed the PHP script in question with PHP.exe. It will print out the errors where the web server would not. Just in case anyone else run into an Error 500 and can't figure out how to debug it.
    Thursday, May 31, 2012 11:52 PM
  • User-166039894 posted

    FWIW : I had similar issues just recently.  But solved it with a very simple fix.  I changed the Error Pages of IIS of the website you are working with to point to /index.php instead.  It looks like WordPress picks up the error when IIS redirects the error the index.php page and then re-redirects the user to the correct install pages.

    My story on this : http://you.arenot.me/2013/01/31/wordpress-new-install-on-windows-iis-7-with-500-internal-server-error/

    Thursday, January 31, 2013 6:23 PM
  • User-382081596 posted

    I found this article in error looking for a similar issue, getting IIS7 to report errors at all, rather than the standard '500 ISE' - Later I stumbled across a very useful snippet of information below, in regards to custom error handlers, and how to configure IIS7...

    Turning off IIS7 custom errors will allow error responses from your application to be sent to remote clients without being censored by the IIS7’s custom errors module.

    You can do this from the IIS7 Admin tool by running “Start>Run>inetmgr.exe”, selecting your website/application/virtual directory in the left-hand tree view, clicking on the “Error Pages” icon, clicking “Edit Feature Settings” action, and then selecting “Detailed Errors”.

    MM33

    Thursday, May 9, 2013 4:00 AM
  • User1325003619 posted

    I've dealing with this problem for months.

    I'm using an stable 5.4 or so version of PHP. And I am not able to make work a later version anymore.

    Sometimes I put hours on it, trying to understand it at all. And I can tell you some clues for solving it, depending on each case.

    The php.ini used must be the correct one.

    Pay attention to the PHPRC enviroment var assigned with the SET Dos command. It must contain the path to the php.ini file you use. In my case, I was allways using the sameone.

    Everyone recommends to use the 32 bit php version. And 32bits C++ also.

    After these and checking the php.ini at last, php.exe and php-cgi.exe stoped reporting errors when executed at the DOS command window. But the fast-cgi error still happens at the browser window.

    I found a good info about a question of numbers. The matter seems to be about 64bits vs 32bits thing. I think that somewhere there must be a problem between software versions that I've not found. Something is working in 32bits and other one in 64bits mode.

    I've got an error number like 0xFFFFFFFFF or so, and I read over there that a bad configuration of 32bits enviroments do a bug with big integer numbers.

    I give up for now. I have no time for more tests.

    If someone can give me an idea it would be fine. Thanks.

    I hope it helps to you too.

    Friday, April 17, 2015 5:40 AM