Clustered LSPHP Servers - Howto?

Discussion in 'PHP' started by Elik, Jul 21, 2011.

  1. Elik

    Elik Member


    I been reading up on the LSAPI and I read this section, which I want t know more on how this can be accomplished and what is needed on the webserver and the dedicated PHP server itself in terms of the files in between.

    Here is the reference:
    Start PHP from command line

    Usually, lsphp is managed by LiteSpeed web server in a single server installation. lsphp can be used in clustered environment with one LiteSpeed web server at the front, load balancing lsphp processes running on multiple backend servers. In such environment, lsphp can be start manually from command with option "-b ", socket address can be IPv4, IPv6 or Unix Domain Socket address.
    for examples:

    ./lsphp -b [::]:3000

    have lsphp bind to port 3000 on all IPv4 and IPv6 address,

    ./lsphp -b *:3000

    So the question is, does the backend lsphp server need access to the /home directory where the php files are located or it can be just small drive with just PHP running on it and have it all on the LSWS installed server for the data processing. Plus, what about the mysql processes, does it come from the lsphp server or from lsws server itself.

    Those are the questions I have so I can build a test system and test it accordly to see how it works and go from there. Just need some basic understanding on how it works to make it all work together.
  2. webizen

    webizen Well-Known Member


    a typical setup is as follows:
    1. start lsphp from command line
    PHP_LSAPI_MAX_REQUESTS=500 PHP_LSAPI_CHILDREN=35 /path/to/lsphp -b IP_address:port
    2. setup external app (such as 'remote php') and script handler (for php handled by 'remote php' ext app) on web server.
    external app:
    address => IP_address: port (in step 1)
    auto start => no


    php scripts on local web server need to be rsync'd over to the lsphp server with the exact path.

    a. if local web server is chroot'd, then chroot needs to map to file system root of the remote server. e.g. if web server chroot is /usr/local/opt, then /usr/local/opt/lsws/DEFAULT/html (default lsws vhost docroot) needs to be rsync'd over and placed on remote server as /lsws/DEFAULT/html.

    b. If no chroot, then /usr/local/lsws/DEFAULT/html should be rsync'd over as /usr/local/lsws/DEFAULT/html.

    mysql processes run on lsphp server or dedicated db server.

Share This Page