README.rdoc

Introduction

Rack Legacy tries to provide interaction with legacy environments like PHP
and CGI while still getting the Rack portability so you don't need a
full Apache/lighttpd stack.

This software is currently BETA quality. Use at your own risk.

Purpose

The PRIMARY use case is while developing an application where Ruby is being
used but there are also some legacy PHP or CGI that is running along-side
your Ruby. This middleware allows you to do that development without the
full Apache stack.

When you take the application to a production environment you can either
leave this middleware in or use a full Apache stack to get more battle
tested performance and security.

USAGE

Installation

gem install rack-legacy

Generic Rack Integration

Put the following in your rack stack:

require 'rack-legacy'
use Rack::Legacy::Php, 'public'

Rails Usage

Rails < 3 is not well supported. This is because Rack::Static (later
turned into ActionDispatch::Static) is not in the Rails stack but instead
processed in the stack that loads Rails prior to Rails running. This means
you cannot insert any middleware before it. This software previously had
some hacks to work around this but with the release of Rails 3 the hacks
where not necessary and therefore removed.

If you still need to use rack-legacy on a Rails 2 app see version 0.1.5.

Legacy Modules

The above configuration just adds PHP support to your stack. That is just
one of currently three modules available. The current modules are:

Rack::Legacy::Cgi

Provides support for executing any standard CGI script. It is important
that script has the executable bit set.

Rack::Legacy::Php

Provides support for executing PHP scripts.

Rack::Legacy::Index

Provides support for running “index.php”, “index.cgi” or “index.html” when
just a directory is specified in the request. You will want to install this
module before the CGI or PHP ones.