spawning multiple php-instances listening on tcp/ip ?

Discussion in 'PHP' started by ts77, May 4, 2006.

  1. ts77

    ts77 Well-Known Member

    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 :).


  2. mistwang

    mistwang LiteSpeed Staff

    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.
  3. ts77

    ts77 Well-Known Member

    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.
  4. mistwang

    mistwang LiteSpeed Staff

    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. :)
  5. ts77

    ts77 Well-Known Member

    > 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.
  6. xing

    xing LiteSpeed Staff

    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.
  7. ts77

    ts77 Well-Known Member

    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
    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 :(.
  8. ts77

    ts77 Well-Known Member

  9. mistwang

    mistwang LiteSpeed Staff

    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. :)
  10. ts77

    ts77 Well-Known Member

    nah, it works fine. just need to use a different port :).
  11. mistwang

    mistwang LiteSpeed Staff

    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 .
  12. ts77

    ts77 Well-Known Member

    Yeah, I only use php spawning its own children.
    the demand spawning doesn't work well with opcode-caches.

Share This Page