Skip to content

Instantly share code, notes, and snippets.

@tka
Created June 17, 2012 04:51
Show Gist options
  • Save tka/2943448 to your computer and use it in GitHub Desktop.
Save tka/2943448 to your computer and use it in GitHub Desktop.
Fire.app v1.2 PHPHandler
class PHPHandler
def initialize(app)
@app = app
end
def call(env)
if env["PATH_INFO"] =~ /\.php$/
php_path = env["PATH_INFO"][1..-1]
body = %x{php #{php_path}}
[200, {"Content-Type" => "text/html"}, body]
else
status, headers, body = @app.call(env)
[status, headers, body]
end
end
end
use PHPHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment