php sapi ? ;)

ts77

Well-Known Member
#1
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
 

mistwang

LiteSpeed Staff
#2
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.
 

ts77

Well-Known Member
#3
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?
 

mistwang

LiteSpeed Staff
#5
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. ;-)
 

ts77

Well-Known Member
#6
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
There is one environment variable can be used to customize PHP LiteSpeed application. PHP_LSAPI_MAX_REQUESTS=XXXX controls how many requests each child process will handle before exit. It protects against memory leak inside PHP. Default value is 500.
What about "PHP_FCGI_CHILDREN=XX" ?
Is there an option like that for lsapi or is it handled differently? How?


Thanks in advance.
 

ts77

Well-Known Member
#8
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?
 

ts77

Well-Known Member
#10
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)
 
Top