php sapi ? ;)

Discussion in 'Feedback/Feature Requests' started by ts77, Mar 18, 2005.

  1. ts77

    ts77 New Member

    hi there,

    I've seen your post on the php-list about committing a sapi-module for connecting php with litespeed.
    just curious ... what problems does this solve in comparison to fast-cgi?


    thx,

    thomas
  2. mistwang

    mistwang LiteSpeed Staff

    Good question. :)
    It adds the ability to override configurations via .htaccess or virtual host configuration, just like Apache's mod_php. It is a major security concern to use PHP with Fast CGI SAPI under shared hosting environment.

    And there are performance advantages over Fast CGI SAPI as well.
  3. ts77

    ts77 New Member

    thanks for your reply.

    how should it work then?
    You talk about performance advantages but litespeed is a single-process webserver.
    doesn't the php still need to run in multiple separate processes so that it will be running kind of like with fast-cgi?
  4. ts77

    ts77 New Member

    eh, sorry you answered the architecture question on the php-list already.
    (for the other ones interested -> http://news.php.net/php.internals/15488)

    I'm still interested in backend-load-balancing on different machines (be it php via fast-cgi or your own sapi :)).
  5. mistwang

    mistwang LiteSpeed Staff

    Yes, it works in similiar way as Fast CGI SAPI.
    Cannot call any code that causes blocking inside a non-blocking event driven application.
    And I don't want to run PHP in another thread, as PHP is not very thread friendly and I don't want the whole server crash with PHP. ;-)
  6. ts77

    ts77 New Member

    sorry to bring up that old thread again ;) ... but its related.
    On page http://www.litespeedtech.com/docs/HowTo_QA.html#qa_php there is a note
    What about "PHP_FCGI_CHILDREN=XX" ?
    Is there an option like that for lsapi or is it handled differently? How?


    Thanks in advance.
  7. mistwang

    mistwang LiteSpeed Staff

    there is no equivalent in litepseed php sapi, should set "instances" to match "max connections".
  8. ts77

    ts77 New Member

    How does that work with php-caches like eaccelerator or mmcache?
    I've had problems with them if the php-processes are spawned depending on the load which would lead to multiple php-instances not controlled by one php-process.
    The php-caches would have their own separate shm-segment for each php-instance which doesn't make too much sense.
    Your architecture *sounds* like it would produce the same result. Or do php-caches even work with it?
  9. mistwang

    mistwang LiteSpeed Staff

    I will check this issue, if it is like what you described, we will make some change to the SAPI module.
  10. ts77

    ts77 New Member

    Yes, this problem exists here too:
    # ipcs

    ------ Shared Memory Segments --------
    key shmid owner perms bytes nattch status
    0x02a622c7 0 nobody 777 1 0
    0x02a622c6 32769 nobody 777 4096 0
    0x00000000 458754 nobody 600 16777216 1 dest
    0x00000000 491523 nobody 600 16777216 1 dest
    0x00000000 524292 nobody 600 16777216 1 dest
    0x00000000 557061 nobody 600 16777216 1 dest
    0x00000000 589830 nobody 600 16777216 1 dest

    (5 lsapi-php processes)
  11. mistwang

    mistwang LiteSpeed Staff

    Ok. Thanks.

    We will change the SAPI module a little bit then.
  12. ts77

    ts77 New Member

    That would be great, thanks!

Share This Page