views:

584

answers:

2

I wish to run PHP and Erlang on a web server. Apache is ruled out, because the backend Erlang process would need to handle around 3000 requests concurrently. So definitely something with a smaller memory footprint like lighttpd...

Which one would you recommend? And why?

+1  A: 

Erlang has built-in web server:

http://yaws.hyber.org/

Which you can use. It is supposed to be really really fast.

If you want to expose Erlang to the web, Yaws is the way to go (in just learning Erlang, so this may be incorrect)

edit:

After digging around a bit, I found that the Erlang webserver (Yaws) CAN run PHP scripts. So your answer is an Erlang webserver!

http://yaws.hyber.org/cgi.yaws

Aiden Bell
You'll have to run PHP as CGI then, which is a fair bit less efficient than running it as an Apache module. An alternative could by to use mod_proxy to forward requests to the Erlang-webserver.
troelskn
A good point, but the question emphasised concurrency, which may be stripped from the extreme concurrency of Erlang by bottlenecking at mod_proxy.
Aiden Bell
Yeah, I know it's kinda odd to be coupling PHP with Erlang, but I really love the way Erlang handles concurrency. However, looks like I either have to bottleneck PHP or Erlang if I want to use this model. Cos, running PHP thru a normal CGI looks pretty brittle when it comes to handling advanced I/O and DB calls.
I think that, because of PHP's semantics, running it under Erlang will be a bottleneck anyway. Maybe stick with PHP for some stuff and farm others out to pure Erlang Yaws. Or create a RESTful system on your YAWS with a PHP frontend. Unless you go pure Erlang, it will be constrictive :(
Aiden Bell
Ok, this might be a long shot, but can I install YAWS on a different port, and call the process directly by specifying the PORT from the front end?
You would be using local sockets. If YAWS is local to the PHP server (whatever it is) you might be able to use named-pipes on Linux/Unix
Aiden Bell
+2  A: 

Its hard to answer this one without more information. What is it you wish to use erlang and php for? Is php your frontend for a backend erlang process? Or is erlang going to do some of the frontend also?

I've seen folks do well with nginx in front of erlang and fastcgi. You could run the php through fastcgi with nginx doing the forwarding. Without more information it would be hard to say more than that.

Jeremy Wall