uwsgi-phpsgi icon indicating copy to clipboard operation
uwsgi-phpsgi copied to clipboard

phpsgi

Open c9s opened this issue 10 years ago • 6 comments

Hi!

Just saw your implementation, I guess you might be interested in PHPSGI servers. we've implemented a http server based on PHPSGI:

  • Specification: https://github.com/phpsgi/phpsgi
  • Server Implementation: https://github.com/phpsgi/Funk

c9s avatar Sep 17 '15 07:09 c9s

Cool, in another issue some users pointed me to this one:

https://github.com/php-fig/fig-standards/blob/master/proposed/http-message.md

unbit avatar Sep 17 '15 07:09 unbit

yeah I know that. :) however they made the spec & implementation way too complicated. and they tries to constraint APIs by making interfaces. (there are too many methods defined in one interface).

phpsgi is different from the psr standards, it's not so high level (you don't have to implement the classes).

And I think the server implementation should be easy & lightweight to provide the maximum flexibility, so that's why we want to create one with PHP's built-in data structure (without classes).

c9s avatar Sep 17 '15 07:09 c9s

Completely agree, i am checking your spec, but i am not sure to understand how you manage the request body (like file uploads). It is something i did not addressed, an IO-like object in php (assuming there is something like that) would be the best thing (like in other languages). Defining an ad-hoc class looks to me overkill (and completely different from the other standards)

unbit avatar Sep 17 '15 07:09 unbit

The specification is not finalized yet. I am currently thinking about the request body part for something like file uploading or multi-part contents. I think it's the most critical part.

PHP SAPI uses something like file_get_contents('php://input') to read the request body with the built-in stream wrapper, so maybe using resource descriptor and register the resource in the environment array would work. what do you think?

c9s avatar Sep 17 '15 08:09 c9s

I think this would also work for PHPSGI: http://search.cpan.org/%7Emiyagawa/PSGI-1.102/PSGI.pod#The_Input_Stream http://search.cpan.org/~miyagawa/PSGI-1.102/PSGI.pod#The_Input_Stream

On Sep 17, 2015, at 15:46, unbit [email protected] wrote:

Completely agree, i am checking your spec, but i am not sure to understand how you manage the request body (like file uploads). It is something i did not addressed, an IO-like object in php (assuming there is something like that) would be the best thing (like in other languages). Defining an ad-hoc class looks to me overkill (and completely different from the other standards)

— Reply to this email directly or view it on GitHub https://github.com/unbit/uwsgi-phpsgi/issues/6#issuecomment-140994503.

c9s avatar Sep 17 '15 08:09 c9s

Hi ! I just updated the spec for input stream: https://github.com/phpsgi/phpsgi/blob/master/SPEC.md#the-input-stream

c9s avatar Sep 18 '15 09:09 c9s