Does your IceWarp server suffer from accidental and hardly reproducible problems with Web/Control service? Does control.exe overload your CPU and stop to response? Then it is probably more than time to switch to multi-threaded FastCGI mode. But remember: multi-threaded modes can be a little bit slower than the default ISAPI hence you may use it only after you are sure there is no other possible solution.
About ISAPI (Default)
PHP in IceWarp Server runs as ISAPI module by default as was said before. Because PHP is not perfect and contains some bugs and memory leaks, sometimes there are big problems with PHP and restart of the whole Web Service is needed. Unfortunately, not all PHP problems can be solved by this restart (which is set after 20000 PHP requests by default) we have added an option to run IceWarp Server in the FastCGI mode since version 9.3.0.
About FastCGI
FastCGI takes care of ISAPI issues by communicating to multiple instances of PHP executables. IceWarp Server starts several instances of php.exe and forwards the PHP requests to it using TCP sockets. Should a problem with PHP occur, php.exe is simply killed and new instance is created without affecting the Web Server at all and the load is effectively balanced between the running instances of php.exe. Remember that the FastCGI mode can be a little bit slower than the default ISAPI one hence you may use it only after you are sure there is no other possible solution.
When to Switch from ISAPI to FastCGI
FastCGI has been seen to resolve all performance issues with any of our customers moved to it. The reason you are most likely crashing is PHP has many issues and is very unstable when run with ISAPI modules in heavy load. If you are not under constant heavy load then it will run without a problem but once the load gets to a certain point it will start crashing.
FastCGI Configuration
Use the dropdown selection in Administration GUI - Web Service settings which allows you to switch between Web Server modes with pre-defined settings. For more options, to fine tune the settings to your particular installation, or to make any changes manually, you will need to edit the [Installation Directory]\config\webserver.dat configuration file, as instructed further.
FastCGI Configuration
If you want to enable FastCGI for specific extension, simply modify file webserver.dat (can be found in <IceWarp>\config) by replacing all php\php.dll with (fastcgi);php\php.exe.
Original form: (ISAPI)
<EXTENSIONS>
<ITEM>
<EXT>.php</EXT>
<MODULE>php\php.dll</MODULE>
Changed form: (FastCGI)
<EXTENSIONS>
<ITEM>
<EXT>.php</EXT>
<MODULE>(fastcgi);php\php.exe</MODULE>
Now check the settings in the Web Service Web Site Scripting tag just to be sure, it should be set like this after the previous changes in webserver.dat:

Set thread pooling to 10 in IceWarp GUI Web Service Other and do not forget to restart the Control Service.

FastCGI Advanced Options
Behaviour of PHP through FastCGI can be modified using following webserver.dat options.
IceWarp Web Server
<OPTIONS>
<FCGI_INITSERVERS>8</FCGI_INITSERVERS>
<FCGI_MAXSERVERS>0</FCGI_MAXSERVERS>
<FCGI_MAXROUNDS>10000</FCGI_MAXROUNDS>
<FCGI_BINDIP>127.0.0.1</FCGI_BINDIP>
<FCGI_CHECKRUNNING>0</FCGI_CHECKRUNNING>
<FCGI_ENVIRONMENT>PHP_FCGI_MAX_REQUESTS=20000</FCGI_ENVIRONMENT>
<FCGI_INITSERVERS> - Number of instances of php.exe which are running immediately after start.
<FCGI_MAXSERVERS> - Maximal number of running instances - not implemented yet. Use Web Server thread pooling to limit number of running instances!!
<FCGI_BINDIP> - IP address bound to php.exe and used to communication between IceWarp server and PHP. This value has to be set. Usually there is no need to put other value than 127.0.0.1 here.
<FCGI_ENVIRONMENT> - Environment variables, which are sent to php.exe to control its behaviour.
PHP_FCGI_MAX_REQUESTS - This environment variable tells php.exe to quit automatically after given number of processed requests.
<FCGI_MAXROUNDS> - Similar option as PHP_FCGI_MAX_REQUESTS, but the counting of requests and killing of instances is responsibility of IceWarp server and not php.exe itself.
<FCGI_CHECKRUNNING> - Boolean value - if set to true, each instance of php.exe is checked, whether it is running or not, before trying to send data to it. This brings slowdown and it is not needed when PHP_FCGI_MAX_REQUESTS is greater than FCGI_MAXROUNDS.
FastCGI ActiveSync-Only Timeout Modifier
This modifier allows to override FastCGI timeout only for specific extension. Global timeout still remains 2 minutes.
<MODULE>(fastcgi)var/phpsocket;scripts/phpd.sh;TIMEOUT</MODULE>
where TIMEOUT is a value in milliseconds, the default setting is 1800000.
If you wish to set the ActiveSync heartbeat higher than the default maximum of 30 minutes, you need to modify the module's settings to extend PHP session time-out. Setting it lower should not be required and this modifier can be omitted (including the semicolon).
FastCGI Quick Howto
In order to move to FastCGI, you need to open the webserver.dat file and then paste this under the [Options] call.
IceWarp Web Server
<OPTIONS>
<FCGI_INITSERVERS>10</FCGI_INITSERVERS>
<FCGI_MAXSERVERS>10</FCGI_MAXSERVERS>
<FCGI_MAXROUNDS>1000</FCGI_MAXROUNDS>
<FCGI_BINDIP>127.0.0.1</FCGI_BINDIP>
<FCGI_CHECKRUNNING>0</FCGI_CHECKRUNNING>
<FCGI_ENVIRONMENT>PHP_FCGI_MAX_REQUESTS=100</FCGI_ENVIRONMENT>
<HTTP10>0</HTTP10>
<NOCHUNKEDENCODING>1</NOCHUNKEDENCODING>
<COMPRESSTHRESHOLD/>
<LOGFORMAT>c-ip cs-username date time cs-method cs-uri-stem cs-version sc-status bytes cs(Referer) cs(User- Agent)</LOGFORMAT>
</OPTIONS>
Save these changes. Now open the Console and go to the Web Service tab and edit the [Default] web site. Once there, move to the [Scripting] tab and edit all extensions except for the [WCS.DLL]. It will look like this:

Do this for every remaing module:
Save this. Now go to the Web Service Other tab and set the Thread pooling to 10. Restart the services and you will now see separate instances of php.exe running in the task manager.
MySQL PDO
You should also move the WebClient PDO storage to a database. The instructions are below for doing this.
http://esupport.icewarp.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=93
|
NOTE: If not using php-custom.ini or php.user.ini to enable MySQL PDO for WebClient, after each version upgrade you will need to uncomment the following lines to get it working again the original php.ini gets overwritten: ;extension=php_pdo_mysql.dll |