Skip to content

shish/spawn-fcgi.php

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

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