paragi / sphp

A snappy PHP execution module / middleware
46 stars 14 forks source link

why not use fastcgi to connect php-fpm ? #7

Closed jet6666 closed 6 years ago

jet6666 commented 6 years ago

php-cgi maybe is not a good chioce .

paragi commented 6 years ago

Thank you for taking time to write me. I think php-fpm would be the right solution, if you can fix the parameter transfer. (node session, websocket, preload etc) I haven't had the time to find a good solution. Do you have a suggestion?

jet6666 commented 6 years ago

Thanks . I'm finding the php-fpm solutions .

1.node-fpm : node-fpm 2.node-fastcgi-client : link

and https://github.com/longbill/node-phpfpm

I just trying checking which one can fulfill my requirement: multriprocessing socket server ,use node as middleware and backend use php

paragi commented 6 years ago

Hi Jet

The target of SPHP is to serve PHP in embedded system with the following options:

These are attributes you would like for your fridge, more than for your public website :) It would be nice to be able to serve both needs in one package!

From the manual: "FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features (mostly) useful for heavy-loaded sites"

The features of this package is not trivial to do with fast-cgi, since you have little control over the superglobals in PHP. It is however a task I would like to attend to, when time permits.

If you have any good insights as how to implement it, it would be appreciated.

If you intent to run a normal website (not embedded) you would probably prefer to optimise for good performance under heavy load. This package does not do that. If you don't need websockets on same port as the HTTP server or don't want to transfer node express session to PHP, you are better of with a basic fast-cgi solution. It's uncomplicated and there are node packages that do just that.

I look forward to your input on the matter.