On Sat, 7 Mar 2020 at 23:50, Paul M. Jones <pmjo...@pmjones.io> wrote:

> Hi Arvids,
>
> > On Mar 5, 2020, at 05:19, Arvids Godjuks <arvids.godj...@gmail.com>
> wrote:
> >
> > one question I do have here is about how PHP-PM process manager will be
> > able to interact with this layer?
> > Cause right now it does rewrite the $_SERVER variable for each incoming
> > request for its child processes that handle the requests
> >
> https://github.com/php-pm/php-pm/blob/a2872e13c3901401d5c2386a8ed62502db23d5f2/src/ProcessSlave.php#L463
> >
> > It kind'a makes this not possible if there is no way to re-init the
> object.
> > While read-only is, obviously, a good idea, there are some caveats like
> > this that not only limit the possibilities but also what will the
> > ServerRequest object even look like when $_SERVER is being rewritten like
> > this?
> >
> > ...
> >
> > it seems that this RFC does not allow such usage at all and long-running
> processing has not been taken into account at all?
>
> I have never used PHP-PM, so I am talking outside my competence here.
>
> Even so, I see the ProcessSlave::prepareEnvironment() method rewrites
> $_SERVER. Instead of re-initializing an existing object, would it be
> sufficient to create a new ServerRequest object after that point, with the
> newly-modified $GLOBALS values (in which $_SERVER is represented)? You
> would then use that new instance in the new child process.
>
> Regarding a long-running process, I could see where the entry point might
> create a new instance of ServerRequest as needed, using the current
> $GLOBALS state, and pass that new instance into whatever handler gets
> invoked.
>
> I am probably missing your point; if so, my apologies, and please guide me.
>

I took a deeper look into the GitHub repo and it answered a few questions -
RFC just didn't give any examples of usage/instantiation and how you can
make a new object. I was thinking it was a read-only global type object
that lives and dies with the start and end of the request.

>
>
> --
> Paul M. Jones
> pmjo...@pmjones.io
> http://paul-m-jones.com
>
> Modernizing Legacy Applications in PHP
> https://leanpub.com/mlaphp
>
> Solving the N+1 Problem in PHP
> https://leanpub.com/sn1php
>
>
>
>

-- 
Arvīds Godjuks

+371 26 851 664
arvids.godj...@gmail.com
Skype: psihius
Telegram: @psihius https://t.me/psihius

Reply via email to