Error Message: CGI Error-The specified CGI application misbehaved by not returning a complete set of HTTP headers

The "CGI Header" error typically this happens more on a faster machine (it has to do with timing of IIS/PHP and database connections). Logging out of the PureCMS system might result in IIS responding with a CGI Error. Refreshing the client browser (press the F5 key) typically results in the login page correctly appearing. If this error happens regularly, try configuring your web server to be optimized for Programs (not Background Services). These options can be found in the System control panel under Performance Options.

There is another option if optimizing your Web server for Programs does not solve the problem. There is a free utility called "FastCGI" that is a generic "plug in" for IIS that helps to execute CGI applications (PHP, Perl, etc.) faster by pooling those processes rather than making IIS launch them for every request. This has been shown to work well with PureCMS to avoid the "CGI Header Error" issues mentioned above.

 

Setting Up FastCGI on IIS for PureCMS

 

  1. Download http://www.caraveo.com/fastcgi/fastcgi-0.6.zip and unpack isapi_fcgi.dll.
  2. Place the "isapi_fcgi.dll" file into the "App\PHP" subfolder of your PureCMS installation directory, e.g. "D:\PureCMS\App\PHP" (the same directory as php.e-x-e)
  3. Copy and paste the following text (between the "----" lines) into a text editor (such as Notepad). Modify the file path for PHP appropriately (point it to your installation folder for PureCMS), and save the file with a ".reg" extension. Then double-click that file and click "Yes" to merge this information into your registry.   Make sure that the file names are in 8.3 format. For example, instead of "c:\program files\globalscape\purecms" use "c:\progra~1\global~1\purecms".

------------------- fastcgi.reg -------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI]
"StartServers"=dword:00000005
"IncrementServers"=dword:00000002
"MaxServers"=dword:00000019
"Timeout"=dword:00000258

[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI\.php]
"AppPath"="D:\\PureCMS\\app\\php\\php.exe"
"BindPath"="php-fcgi"
---------------------------------------------------------

  1. Change script mappings for .PHP to point to D:\PureCMS\app\php\isapi_fcgi.dll instead of PHP.exe.  This is done in the IIS manager: right-click on the PureCMS site and choose "Properties." Change to the "Home Directory" tab and click the "Configuration" button in the bottom right. Go to the "App Mappings" tab. Find the ".php" extension in the "Application Mappings" list, click it and choose "Edit." For the Executable entry, "Browse" and find the isapi_fcgi.dll location and choose that.

 

  1. Copy PHP.INI from d:\PureCMS\Main\ into d:\PureCMS\App\php\php.ini (this is a very important step!!!)
    8) For FastCGI to work properly, you will need to use PHP 4.3.4; PureCMS ships with PHP 4.3.3.
  2. Download PHP 4.3.4 here, and unzip the following files into your PureCMS PHP folder (e.g. c:\program files\globalscape\purecms\app\php\) -- overwrite whatever files are already there:  php.exe, php_ts.dll, and mssql.dll
  3. Restarted the web server. To do so, open a command prompt window and type "iisreset".
  4. Access PureCMS from a browser. Installing FastCGI should eliminate the "This application has misbehaved" errors.