PDA

View Full Version : php sapi ? ;)


ts77
03-18-2005, 04:07 AM
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
03-18-2005, 09:57 AM
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
03-18-2005, 10:06 AM
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?

ts77
03-18-2005, 10:14 AM
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 :)).

mistwang
03-18-2005, 10:17 AM
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
05-27-2005, 03:07 PM
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.

mistwang
05-28-2005, 05:11 PM
What about "PHP_FCGI_CHILDREN=XX" ?
there is no equivalent in litepseed php sapi, should set "instances" to match "max connections".

ts77
05-29-2005, 06:16 AM
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?

mistwang
05-31-2005, 10:50 AM
I will check this issue, if it is like what you described, we will make some change to the SAPI module.

ts77
06-01-2005, 06:40 AM
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)

mistwang
06-01-2005, 10:32 AM
Ok. Thanks.

We will change the SAPI module a little bit then.

ts77
06-01-2005, 12:40 PM
That would be great, thanks!