GX::Engine::FCGI

Module Version: 0.2000_01

NAME

GX::Engine::FCGI - FastCGI engine component

SYNOPSIS

package MyApp::Engine;

use GX::Engine::FCGI;

MyApp::Engine->setup(
max_request_size => 1048576,
max_request_memory_usage => 16384
);

1;

DESCRIPTION

This module provides the GX::Engine::FCGI class which extends the GX::Engine class.

METHODS

Constructor

new

Returns the engine component instance.

$engine = $engine_class->new;
Returns:
Exceptions:

Public Methods

setup

Sets up the engine component.

$engine_class->setup( %options );
Options:
  • buffer_size ( integer )

    Defaults to 8192 bytes.

  • max_request_memory_usage ( integer )

    Defaults to 16384 bytes.

  • max_request_size ( integer )

    Defaults to 1048576 bytes.

Exceptions:

Internal Methods

finalize_response_headers

Handler.

$engine->finalize_response_headers( $context );
Arguments:

process_request_body

Handler.

$engine->process_request_body( $context );
Arguments:

process_request_headers

Handler.

$engine->process_request_headers( $context );
Arguments:

send_response

Handler.

$engine->send_response( $context );
Arguments:

EXPORTS

Application Class

handler

Internal method.

$application_class->handler( $fcgi );
Arguments:
  • $fcgi ( HASH reference )

    A reference to a hash with the current FastCGI environment variables.

Context Class

fcgi

Returns a reference to a hash with the current FastCGI environment variables.

$fcgi = $context->fcgi;
Returns:
  • $fcgi ( HASH reference )

I/O ADAPTORS

For internal use only.

  • Input stream class

    GX::Engine::FCGI::InputStream

  • Output stream class

    GX::Engine::FCGI::OutputStream

  • Error stream class

    GX::Engine::FCGI::ErrorStream

SERVER SETUP

Apache2 - Managed Mode with mod_fcgid

Example (Apache/2.2.13 on openSUSE 11.2):

/etc/apache2/default-server.conf:

LoadModule fcgid_module /usr/lib/apache2/mod_fcgid.so
SocketPath /tmp/fcgid.socket
SharememPath /tmp/fcgid.shm

Listen 8080

<VirtualHost *:8080>

DocumentRoot /srv/www/myapp/public

<Directory /srv/www/myapp/public>
Order Deny,Allow
Allow from All
</Directory>

<Directory /srv/www/myapp/script/server>
Options ExecCGI
AddHandler fcgid-script .pl
Order Deny,Allow
Allow from All
</Directory>

Alias /favicon.ico /srv/www/myapp/public/favicon.ico
Alias /static/ /srv/www/myapp/public/static/
Alias /error/ /usr/share/apache2/error/
Alias / /srv/www/myapp/script/server/fcgi.pl/

</VirtualHost>

Start Apache:

/etc/init.d/apache2 start

Note: Make sure that the apache2-mod_fcgid package is installed.

For more information on using FastCGI under Apache2 with mod_fcgid visit http://httpd.apache.org/mod_fcgid/.

Lighttpd - Standalone Mode

Example (lighttpd/1.4.20 on openSUSE 11.2):

/etc/lighttpd/modules.conf:

include "conf.d/fastcgi.conf"

/etc/lighttpd/lighttpd.conf:

server.document-root = "/srv/www/myapp/public/"

/etc/lighttpd/conf.d/fastcgi.conf:

$HTTP["url"] !~ "^/static/" {
fastcgi.server = (
"/" => (
"MyApp" => (
"socket" => "/tmp/myapp.socket",
"check-local" => "disable"
)
)
)
}

Use the myapp/script/server/fcgi.pl script to start the application server, e.g.:

fcgi.pl --listen /tmp/myapp.socket --processes 5

Start lighttpd:

/etc/init.d/lighttpd start

For more information on using FastCGI under Lighttpd visit http://www.lighttpd.net.

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright © 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.