예제 #1
0
파일: gophp.go 프로젝트: kiancyc/gophp
// serve http with php script(cgi mode)
func Cgi(w http.ResponseWriter, r *http.Request, phpBin string, scriptFileName string) {
	handler := new(cgi.Handler)
	handler.Path = phpBin
	handler.Env = append(handler.Env, "REDIRECT_STATUS=CGI")
	handler.Env = append(handler.Env, "SCRIPT_FILENAME="+scriptFileName)

	handler.ServeHTTP(w, r)
}
예제 #2
0
파일: cgi.go 프로젝트: rkoesters/rsrv
func CgiHandler(config map[string]string) http.Handler {
	h := new(cgi.Handler)

	h.Path = mustGet(config, "path")
	h.Root = mustGet(config, "mount")
	h.Dir = tryGet(config, "dir", "")
	h.Args = getSlice(config, "args")
	h.Env = getSlice(config, "env")
	h.InheritEnv = getSlice(config, "inherit")

	h.PathLocationHandler = http.DefaultServeMux

	return h
}