News for hackers. Stuff that matters.
Re:Combining Golang and PHP can solve real-world development... by kilburn on Monday December 10, 2018 @06:19PM (#18651988)
In typical PHP applications, the entire application is bootstraped, executed and teared down for every request.

RoadRunner lets you run "workers" (php processes) that perform all the bootstrapping just once, and then receive-process-reply to requests. The use case is to avoid the (possibly expensive, especially with modern frameworks) bootstrapping for every request.

Check the symfony integration example for instance [1]. Everything that's outside of the

  while ($req = $psr7->acceptRequest()) {
  ...
  }
is usually run for every request in traditional PHP, whereas here it is only run once when initializing the worker and then that while block reads/executes/replies to each specific request.

The problem with this approach is that you now need to be careful not to leave unwanted stuff behind (open files / db connections, static $properties, etc.) that may interfere with future requests, whereas this just isn't possible in "normal" PHP. I would argue that this is one of the features that makes PHP so beginner-friendly.

[1] https://github.com/spiral/roadrunner/wiki/Symfony-Framework

Re:Combining Golang and PHP can solve real-world development... by rajangdavis on Monday December 10, 2018 @07:18PM (#18652320)
Got it. Thanks for the explanation!