H-Sphere Documentation Administrator Guide

 

Advanced PHP Mode Settings

(3.1 Beta 1 and up)
 
 

Related Docs:   Physical Servers Enabling PHP in Web Options (User Guide)

Last modified: 08 May 2007

 

In H-Sphere 3.1 branch it is made possible not only to switch between PHP 4 and 5 versions for Unix Web boxes, but also to choose a particular PHP mode: libphp (default), cgi, or fastcgi (the latter is implemented only since 3.1).

  • libphp - PHP runs as an Apache module. The advantage is that PHP is always in memory use which results in a higher speed capability and lower server load.
  • cgi - PHP runs as a CGI script in a separate process which starts with each request and completes its work upon the script execution. This provides a simpler and more secure PHP work, but draws excessive memory usage and higher memory load.
  • fastcgi - PHP also runs as a CGI script, but under a single process which does not stop when the script is executed. This allows to minimize server load while running PHP in CGI mode.

To configure advanced PHP mode settings in admin CP, go to E.Manager->Servers->P.Servers and click on the Settings icon for a physical server. You will see the following interface:

PHP 4/5 Modes Form

This form allows you to choose which PHP 4 and PHP 5 libphp/cgi/fastcgi modes will be available for end users whose domains are hosted on this physical server, and to set the default mode for each PHP version.

The fastcgi and cgi modes can be enabled for both PHP 4 and PHP 5, but the libphp mode only for one of the PHP versions. Modes checked as Enabled will be available for end users to choose from in the Advanced PHP configuration interface in Web Options. When users switch PHP version in the "simplified" PHP configuration interface, they switch between the default modes of PHP versions (the Default column in the form - choose one default mode per PHP version). After that, selected modes will be available for users to choose from for each domain.

If you have enabled fastcgi mode, you can configure its VirtualHost options in the form below:

FastCGI Options
  • fcgi_idle-timeout - the number of seconds of FastCGI application inactivity allowed before the request is aborted and the event is logged (at the error LogLevel). The inactivity timer applies only as long as a connection is pending with the FastCGI application. If a request is queued to an application, but the application doesn't respond (by writing and flushing) within this period, the request will be aborted. If communication is complete with the application but incomplete with the client (the response is buffered), the timeout does not apply.
  • fcgi_killInterval - determines how often the dynamic application instance killing policy is implemented within the process manager. Smaller numbers result in a more aggressive policy, larger numbers a less aggressive policy.
  • fcgi_minProcesses - minimum total number of dynamic FastCGI application instances allowed to run at any one time without being killed off by the process manager (due to lack of demand).
  • fcgi_maxClassProcesses - maximum number of dynamic FastCGI application instances allowed to run for any one FastCGI application. It must be less or equal to maxProcesses (this condition is not programmably enforced).
  • fcgi_maxProcesses - maximum total number of dynamic FastCGI application instances allowed to run at any one time. It must be greater or equal to maxClassProcesses (this condition is not programmably enforced).
  • fcgi_restart - causes the process manager to restart dynamic applications upon failure (similar to static applications).
  • fcgi_multiThreshold - an integer between 0 and 100 used to determine whether any one instance of a FastCGI application should be terminated. If the application has more than one instance currently running, this attribute will be used to decide whether one of them should be terminated. If only one instance remains, -singleThreshold is used instead.
  • fcgi_singleThreshold - An integer between 0 and 100 used to determine whether the last instance of a FastCGI application can be terminated. If the process manager computed load factor for the application is lower than the specified threshold, the last instance is terminated. In order to make your executables run in the "idle" mode for the long time, you would specify a value closer to 1, however if memory or CPU time is of primary concern, a value closer to 100 would be more applicable. Setting it to 0 will prevent the last instance of an application from being terminated; this is the default value, changing it is not recommended (especially if -appConnTimeout is set).
  • fcgi_updateInterval - determines how often statistical analysis is performed to determine the fate of dynamic FastCGI applications.

Related Docs:   Physical Servers Enabling PHP in Web Options (User Guide)



© Copyright 1998-2008. Positive Software Corporation.
All rights reserved.