A Server Error Appears During a Long Debug Session

Follow

Applies To

 

Zend Server

Zend Studio

Windows

 

Symptom

An error message appears when remotely debugging a PHP application running on a Windows server. Depending on the Web server, the error is either the standard HTTP Error 500 or the Open/Save dialog prompting you to save an empty file:

 

Technical Details

This problem happens only on Windows with Zend Server installed and the PHP code is handled by FastCGI on this platform. The available FastCGI implementations are very limited in their ability to communicate with the Web server on one side, and with the PHP-CGI process on the other side. Therefore, during a long debug session the FastCGI process may reach its timeout while waiting for PHP to complete the debug session. The FastCGI may then return an error to the Web server even though the PHP process is still working.

 

Resolution / Workaround

To workaround this limitation, the user can increase the timeout value to a reasonably high number, thus eliminating the possibility that a timeout will occur. The instructions for all supported Web servers are given below. In all cases, restart the Web server after making the change.

Zend Server 8.5.x and prior releases with Apache

If Zend Server is installed with the bundled Apache Web server, it uses the FastCGI component called Zend Enabler. Edit the configuration file of Zend Enabler as it appears in the below Listing (the timeout value is shown in bold):

Listing of <Zend Server installation directory>\etc\ZendEnablerConf.xml :
<?xml version="1.0" encoding="UTF-8"?>
<ZendEnablerConfiguration version="2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="ZendEnablerConf.xsd">
  <Global>
    <LogFile path="C:\Program Files\Zend\ZendServer\logs\ZendEnabler.log"
      verbosity="0" maxFileSizeKB="100" />
  </Global>
  <DefaultPool impersonation="true">
    <Environment>
      <Variable name="DB2INSTANCE" value="DB2" />
      <Variable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
      <Variable name="TEMP" value="C:\DOCUME~1\user\LOCALS~1\Temp" />
      <Variable name="PHPRC" value="C:\Program Files\Zend\ZendServer\etc" />
      <Variable name="PATH"
        value="C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Zend\MySQL51\bin;C:\Program Files\Zend\ZendServer\bin" />
    </Environment>
    <ProcessCount start="2" extra="8" />
    <Timeouts connectionTimeout="60" requestTimeout="1200" />
  </DefaultPool>
  <ServerPool mimeType="application/x-httpd-php"
    commandLine="C:\Program Files\Zend\ZendServer\bin\php-cgi.exe"
    impersonation="true">
  </ServerPool>
</ZendEnablerConfiguration>

 

Zend Server 9 with Apache

In Zend Server 9 with Apache, the Fast CGI component Zend Enabler no longer exists. Fast CGI directives are set in the main Apache configuration file httpd.conf which is located in the folder <Zend Server installation directory>\Apache24\conf. The relevant configuration directives FcgidIOTimeout (the maximum period of time the module will wait while trying to read from or write to a FastCGI application) and FcgidConnectTimeout (the maximum period of time the module will wait while trying to connect to a FastCGI application) are found towards the end of the file:

FastCGI section in <Zend Server installation directory>\Apache24\conf\httpd.conf:
...
FcgidInitialEnv SystemRoot "C:/Windows/"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/Windows/Temp"
FcgidInitialEnv TMP "C:/Windows/Temp"
FcgidInitialEnv windir "C:/Windows/"

FcgidIOTimeout 300
FcgidConnectTimeout 60
FcgidMaxRequestsPerProcess 1000
FcgidMaxProcesses 50
FcgidMaxRequestLen 512000000
# Location php.ini:
FcgidInitialEnv QT_PLUGIN_PATH "C:/Program Files (x86)/Zend/ZendServer/bin"
FcgidInitialEnv PHPRC "C:/Program Files (x86)/Zend/ZendServer/etc"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 10000
...

 

Internet Information Services (IIS) 5 and 6

If Zend Server is installed with IIS 5 or 6, it uses the FastCGI component provided by Microsoft. Edit the configuration file of Microsoft FastCGI by addidng two timeout lines to the default setup. See the below Listing (the timeout parameters are shown in bold):

Listing of %windir%\system32\inetsrv\fcgiext.ini :
...
[Types]
php=PHP
[PHP]
ExePath=C:\Program Files\Zend\ZendServer\bin\php-cgi.exe
EnvironmentVars=PHPRC:C:\Program Files\Zend\ZendServer\etc,PHP_FCGI_MAX_REQUESTS:10000
ActivityTimeout=1200
RequestTimeout=1200
...

 

Internet Information Services (IIS) 7, 8 and 10

If Zend Server is installed with IIS 7, it uses the built-in FastCGI component of the Web server. To edit the timeout values follow the below procedure :

  1. Open the Internet Information Services Manager (go to Start | Run, type "InetMgr" and click OK).
  2. Select your server from the Connections list.
  3. In the main area double-click the FastCGI Settings icon:

  1. In the list that appears, select the PHP entry and click Edit on the Actions pane. This opens the FastCGI Application parameters dialog.
  2. Increase the values of ActivityTimeout and RequestTimeout.
  3. Click OK to save the changes.

 


Excerpt: When remotely debugging a PHP application running on a Windows server (Zend Server), an error message appears. This article provides a workaround for the cases when the problem is caused by a FastCGI timeout.


Original Post Date: 2010-10-27 18:41:23

Alternative Description:

When remotely debugging a PHP application running on a Windows server (Zend Server), an error message appears. This article provides a workaround for the cases when the problem is caused by a FastCGI timeout.

_____
Tags: ActivityTimeout,debug,FastCGI,fcgiext.ini,HTTP Error 500,MS Windows 2003 Server,MS Windows 2008 Server,MS Windows 2012 Server,MS Windows 7,MS Windows 8,MS Windows XP,RequestTimeout,timeout,Zend Enabler,Zend Server,Zend Server 4.x,Zend Server 5.x,Zend Server 6.x,Zend Server 7.x,Zend Studio 10.x,Zend Studio 11.x,Zend Studio 7.x,Zend Studio 8.x,Zend Studio 9.x,Zend Studio for Eclipse 6.x,ZendEnablerConf.xml,oldKB,attachment

Have more questions? Submit a request

Comments

  • Avatar
    Peter H. Mantos

    The solutions apply to ZendServer and IIS. I am experiencing the problem using Apache (without ZendServer) under windows 7. I and using FastCGI. How do I correct this problem?

  • Avatar
    Peter H. Mantos

    One of the following parameters (in httpd.conf) addressed the issue in Apache 2.4. I don;t know which:

    FcgidBusyTimeout 600
    FcgidIdleTimeout 600
    FcgidConnectTimeout 600
    FcgidIOTimeout 600
    FcgidIdleScanInterval 600
    FcgidProcessLifeTime 0
    FcgidIdleTimeout 600

Powered by Zendesk