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:
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):
<LogFile path="C:\Program Files\Zend\ZendServer\logs\ZendEnabler.log"
verbosity="0" maxFileSizeKB="100" />
<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" />
value="C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Zend\MySQL51\bin;C:\Program Files\Zend\ZendServer\bin" />
<ProcessCount start="2" extra="8" />
<Timeouts connectionTimeout="60" requestTimeout="1200" />
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:
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/Windows/Temp"
FcgidInitialEnv TMP "C:/Windows/Temp"
FcgidInitialEnv windir "C:/Windows/"
# 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):
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 :
- Open the Internet Information Services Manager (go to Start | Run, type "InetMgr" and click OK).
- Select your server from the Connections list.
- In the main area double-click the FastCGI Settings icon:
- In the list that appears, select the PHP entry and click Edit on the Actions pane. This opens the FastCGI Application parameters dialog.
- Increase the values of ActivityTimeout and RequestTimeout.
- 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
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.