From Phrame version 3.1 onwards Phrame action servers run in a so-called Phrame container. A single container may support multiple action servers.
The PhrameContainer class mimicks some of the functionality of a Java web container, which in pre 3.1 versions used to be part of the ActionServer class. See How To Trigger The Phrame Container for details on how to create a PhrameContainer instance and run action servers in it.
Each Phrame application uses its own action server, fired up from the bootstrap script of the application. The bootstrap script is also the place to configure the action server.
For a simple web application, consisting of only one or a limited number of application modules, there will typically be only one bootstrap file. This will be the only script your users actually use. It makes sense to give this script the name of your application or something like index.php.
A more complex application could have one bootstrap script for each application module or cluster of closely related application modules. This is more or less similar to the concept of Java Servlets.
As a minimum, a bootstrap script has to perform the following tasks:
- Include Phrame's core classes;
- Include or define the array holding the configuration parameters for the
ActionServer;
- Construct an
ActionServer object;
- Call the
process() method of the ActionServer.
Note that a bootstrap script normally does not refer to an action. To force the action server to show the first web page of your application, you have to either define a welcome file in the server configuration (see the example below) or define a default action in the module configuration for the default application module (see the how-to "Define A Module Configuration").
You could also define a named application module in your bootstrap script to force the action server to load a specific module configuration with a matching default action (see the how-to "Trigger An Action").
The following code snippet gives an example of a bootstrap script.
//Include Phrame's core library
include('/WEB-INF/lib/phrame/include.php');
// Include array holding the server configuration
include('/WEB-INF/conf/server-options.php');
// Construct a server instance
// Note that the & is not needed (strictly speaking
// not even allowed) in PHP5.
$myServer =& new ActionServer($options);
// Fire up the server
$myServer->process();