class RackPhpProxy

def perform_request(env)

def perform_request(env)
  request = Rack::Request.new(env)
  if request.path =~ %r{\.php}
    env["HTTP_HOST"] = ENV["HTTP_HOST"] ? URI(ENV["HTTP_HOST"]).host : "localhost"
    ENV["PHP_PATH"] ||= '/manual/en/tutorial.firstpage.php'
     
    # Rails 3 & 4
    env["REQUEST_PATH"] = ENV["PHP_PATH"] || "/php/#{request.fullpath}"
    # Rails 5 and above
    env['PATH_INFO'] = ENV["PHP_PATH"] || "/php/#{request.fullpath}"
    env['content-length'] = nil
    
    super(env)
  else
    @app.call(env)
  end
end