Max
Max

Reputation: 6394

PHP in Go. FastCGI?

I am writing webserver in Go that will replace existing website. I still need some old PHP scripts. Right now I have lighttpd + fastcgi. So I wish my web server to call PHP as FastCGI.

What is best way to handle it? I guess I need some Go FastCGI API

http://golang.org/pkg/net/http/fcgi/ - It seems only to support Server side not client.

Upvotes: 4

Views: 1454

Answers (1)

Ask Bjørn Hansen
Ask Bjørn Hansen

Reputation: 6943

I think you'd have to make your own if you want to connect directly to a fastcgi process. Keep in mind though that you still have to run a process manager/spawner anyway, so it wouldn't be a huge leap to just run nginx, too, and have your Go process proxy there for the PHP scripts.

You could also reasonably turn it around and have end-users connect to nginx on port 80 and have nginx proxy requests to your Go process or fastcgi as appropriate. One advantage of that is that then easily can have the Go process run as a different user than root.

Upvotes: 3

Related Questions