PDA

View Full Version : spawning multiple php-instances listening on tcp/ip ?


ts77
05-04-2006, 12:17 PM
Hi there,

are there some nice and simple command-line options to let litespeed start multiple php-fcgi instances (those are different versions) listening on different ports (needed for multi-server usage) instead of using a socket?

I'm currently using spawn-fcgi but that install takes only one php instance either. I might try to experiment with it further if there's no option in lsws to do this ... just wanted to try this route first :).


thanks,

thomas

mistwang
05-04-2006, 01:17 PM
You can let fcgi application started by LSWS using tcp instead of unix socket. but LSWS only start them on demand, so it may not be a good choice for pure fcgi spawner. :-)

Actually, php-fcgi itself has an option "-b" to bind to an address. It hasnot be implemented in earlier release, but seems now it is.

ts77
05-04-2006, 01:23 PM
hmm, good point mistwang.
any good pointers for some standalone fcgi-spawner?
I want the two servers being able to use each others php-processes as they will work in a failover environment.

mistwang
05-04-2006, 01:28 PM
Only other standalone fcgi-spawner I know of is the "cgi-fcgi" from FCGI SDK. ;-) May not be anything better than fcgi-spawner.

Maybe I can add an option to let LSWS start FCGI at server startup. :-)

ts77
05-04-2006, 01:30 PM
> Maybe I can add an option to let LSWS start FCGI at server startup.

yeah, that would be very cool :D no need for external spawners anymore.

xing
05-08-2006, 02:28 AM
Release 2.1.15 now has this feature. You can now optionally set configured external applications to start on server start-up versus on-demand. Enjoy.

ts77
05-08-2006, 03:10 AM
thanks, I'll try it out ASAP.

just another question:
with spawn-fcgi I have that option in the config:

## IP adresses where PHP should access server connections
## from
FCGI_WEB_SERVER_ADDRS="127.0.0.1,192.168.0.1"


Is that a simple ENV-variable which is used from php if given or is that something unique to spawn-fcgi?

I think the web is really lacking some description of the php fastcgi setup without using some predefined stuff :(.

ts77
05-08-2006, 04:38 AM
just for the record: it seems like those ENV-variables are in the specs.
I found this
http://www.fastcgi.com/devkit/doc/fcgi-spec.html#S2.3
on the fastcgi.com site.

mistwang
05-08-2006, 11:02 AM
Thanks for the information. It may not work well when you need to start multiple instances binding to the same address, may got address is already in use error. :)

ts77
05-08-2006, 11:05 AM
nah, it works fine. just need to use a different port :).

mistwang
05-08-2006, 11:12 AM
Yeah, it depends on how it was used. Pretty handy for FastCGI that can spawn children process, but is not good for on demand dynamic spawning that LSWS is capable of .

ts77
05-08-2006, 11:50 AM
Yeah, I only use php spawning its own children.
the demand spawning doesn't work well with opcode-caches.