Skip to content

shish/spawn-fcgi.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

A shim to host FastCGI webapps on a PHP webhost

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published