PHP in Yaws (was: Re: erlguten)

Carsten Schultz <>
Tue May 25 00:23:46 CEST 2004


On Mon, May 24, 2004 at 04:46:49PM +0200, Marc van Woerkom wrote:
> >What is Yaws support for php?  - are we looking for volunteers to
> >write a php interpretor in erlang? << actually this would be great
> >fun, there is no reason to imagine that a php interpretor
> >implemented in Erlang would be slow. Anybody got a PHP yacc
> >grammar? >>
> 

This would probably be fun.

[...]
> No idea yet, if there is any need here, for switching web 
> servers. But I guess if yaws would be able to run our 
> code, then this might push yaws forward as a real 
> workhorse.
> 
> What is the status of PHP support in Yaws?

Of course, the idea behind yaws is to obliterate the need for PHP :-)

At the moment, Yaws can run PHP via the cgi version of the
interpreter.  Works ok for simple things, but is completely contrary
to the idea of Yaws/Erlang, because you start one OS(!) process per
request.  Too many processes and the startup costs of the interpreter
for every request.

It would be not too hard to interface Yaws with the FastCGI version of
PHP instead.  Actually what I was thinking of doing is using a
mechanism similar to FastCGI, especially since the FastCGI interface
of PHP is at the moment not multi-threaded iirc, but using several
worker processes.  (Is the multi-threaded PHP stuff stable?)  I have
already looked into the source of the PHP FastCGI SAPI (Server API),
and if I had found documentation on how to write a PHP SAPI (there are
already several), then I would probably already have tried writing one
that could easily be used from Erlang via open_port.  Of course, one
could even link it into Yaws, but if the data passing overhead does
not seem to big, I would prefer to keep the PHP thingy in a different
OS process.  (A comment in the FastCGI SAPI code mentioned that php
processes should be restarted regularly, because some of the functions
leak memory :-|)

> Who is working on a PHP engine in Erlang/Yaws?

I have done the basic CGI support in Yaws.  A PHP interpreter (or
compiler, or whatever :-) in Erlang would be fun, but imho only worth
the trouble if the standard PHP interpreter really sucked.  Does it?

Greetings,

Carsten

BTW, I am currently looking for a job.
http://www.cartoonbank.com/assets/2/50825_l.jpg
Ok, not that bad yet :-)

-- 
Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin
http://carsten.codimi.de/
PGP/GPG key on the pgp.net key servers, 
fingerprint on my home page.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20040525/4feb0611/attachment.bin>


More information about the erlang-questions mailing list