A shim to host FastCGI webapps on a PHP webhost
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore ignorance Jul 2, 2012
.htaccess redirect traffic to spawn-fcgi.php Jul 5, 2012
README.rst allow configuration in an external file Aug 19, 2012
demo.py updates Jul 1, 2014
spawn-fcgi.php updates Jul 1, 2014

README.rst

Spawn-FCGI.php

A script to translate PHP requests into FastCGI requests, thus allowing hosting of FastCGI apps (good) on any PHP-compatible web host (cheap, common).

The auto-spawning feature requires that PHP have the shell_exec feature enabled

Currently only Unix sockets are supported as FastCGI transport; TCP sockets shouldn't be too hard to add.

Configuration

Create a spawn-fcgi.conf.php file::

<?php
define("SPAWN", "spawn-fcgi -s /tmp/fcgi.sock -- python demo.py fastcgi");
define("SOCKET", "/tmp/fcgi.sock");
?>

Change the SPAWN define to be a command which creates a daemon process and a Unix socket.

Change the SOCKET define to point at said socket.

Credits

This is almost a direct port of Flup's FastCGI test harness, flup_fcgi_client.py (c) 2006 Allan Saddi <allan@saddi.com> + 2011 Vladimir Rusinov <vladimir@greenmice.info>

Modified to take request data from the environment rather than from function parameters.

PHP port + modifications (c) 2012 Shish <webmaster@shishnet.org>