Oracle iPlanet Web Server 7.0.9 Administrator's Guide

Configuring the Virtual Hosting Environment

The virtual hosting environment aims to protect potential security and performance problems associated with sharing a PHP engine with several virtual servers.

Using Web Server 7.0 environment variables, you can assign same PHP binary with a separate engine bound to each virtual server. Be sure that each virtual server has its own php.ini file.


Service fn=responder-fastcgi
        app-path="/path/to/php/php_fcgi"
        bind-path="$(lc($urlhost))"
        req-retry=5
        type="*magnus-internal/fastcgi*"
        app-env="PHPRC=/path/to/users/$(lc($urlhost))/config"
        app-env="PHP_FCGI_CHILDREN=5"
        app-env="PHP_FCGI_MAX_REQUEST=200"
        min-procs=1
        restart-interval=10
        bucket="php-bucket"
        rlimit_cpu=60

The Web Server tmp directory now shows Unix domain sockets named after individual virtual servers processing PHP requests. This configuration is possible by using a single PHP FastCGI binary for all users. Thus, the single binary must possess all the required plugins compiled with it. The solution for the previously mentioned difficulty is to ensure that each user has a own copy of the PHP binary as needed.


Service fn=responder-fastcgi
        app-path="/path/to/users/$(lc($urlhost))/php_fcgi"
        bind-path="$(lc($urlhost))"
        req-retry=5
        type="*magnus-internal/fastcgi*"
        app-env="PHPRC=/path/to/users/$(lc($urlhost))/config"
        app-env="PHP_FCGI_CHILDREN=5"
        app-env="PHP_FCGI_MAX_REQUEST=200"
        min-procs=1
        restart-interval=10
        bucket="php-bucket"
        rlimit_cpu=60

It is also possible to allow different PHP binaries for each application by controlling the structure of the URI space.

For example:

If the URI space is structured as:

/app/foo.php

where /app is the name of the overall application and is always the first directory in the URI structure ending with a PHP file.


<If uri~=^/(\w+)/\w+\.php$>
						Service fn=responder-fastcgi
						app-path="/path/to/users/$(lc($urlhost))/$1/php_fcgi"
						bind-path="$(lc($urlhost))_$1"
						req-retry=5
						type=+magnus-internal/fastcgi*"
						app-env="PHPRC=/path/to/users/$(lc($urlhost))/config"
						app-env="PHP_FCGI_CHILDREN=5"
						app-env="PHP_FCGI_MAX_REQUEST=200"
						min-procs=1
						restart-interval=10
						bucket="php-bucket"
						rlimit_cpu=60
</If>

This invokes a specifically built PHP FastCGI binary which binds to a uniquely named Unix domain socket. Thus, there is no interference with another PHP application or another virtual server. However, this process uses up a lot of memory because of many PHP processes around.