Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95796 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58678 invoked from network); 8 Sep 2016 14:05:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Sep 2016 14:05:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.43 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.213.43 mail-vk0-f43.google.com Received: from [209.85.213.43] ([209.85.213.43:35645] helo=mail-vk0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/EA-36123-12071D75 for ; Thu, 08 Sep 2016 10:05:22 -0400 Received: by mail-vk0-f43.google.com with SMTP id 16so22535070vko.2 for ; Thu, 08 Sep 2016 07:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=+MY05tEXuDddjxlWxUKbtXohkvJ74QKx7mJ0ta2CKH8=; b=Nb11v8ljDn3qm/ALQ9EKnaQ40Rzplg6kzVir2kqBle2MNL9nh+gOkYCZx7/BWX89Q/ E13x8lxwkJktLoczsJSFMMkd4vIMLm0/rg2p/2OMC+BBYi4CBK4YuyRqhdCnP9PSlknt a3ZRzfWPY/2qg0haN8x1fWCT+k/KL3cHUcT9WvtBuxgvT4RuX9QlNUPmwq8Ob4xJMHb+ JWUXEiT13x1keEF/ntz3k1z2l+F41/Rm7AlVLR56VznGhAiIgGic4aEw2JKJTPk20yHe OGc1N8hCXz2xu05Z8wXWktmPIA1f9Y7cnadnPuMTjzo2LLetIqaA2c82UwRoadyIMvj2 QUUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=+MY05tEXuDddjxlWxUKbtXohkvJ74QKx7mJ0ta2CKH8=; b=JAQWXjsXOXeCVuDpI970IGQhHnbynq19xC368It1Xzvp2XtUA6jma0z9ND903PGgkc gWm8fs8Kh81VJLHpJ88LGO8+lx04tQBOJlf/n75A0KcH2vDiadclbWA2xYOtmOeDezUE rj9qrunpZ88kNIOXXK9yaiC6jagfVPgTyDlZ55zhIThn1OJbznVciG8Ru6oZm22G0gW8 8AQLdssOGDujGdGy1zEhE40Ca+4DqX8ekmbf8D40XlgNz0Kb1bjBoCRLwRXlBDLZ3EAc H9y4oiLvdqcgG7B3btBPzMTz8bgpdj1iFTUuMW19LBr920WmhzNf7/68SRuMBdCFw193 m4KA== X-Gm-Message-State: AE9vXwNxa+fDptv2J8KmUexIDkfp8eJP134SoYQt9I+LqxcTREuW5TLNx5oFHCJ4R26helWV9+/tIT2DBx9gyg== X-Received: by 10.31.61.73 with SMTP id k70mr848457vka.149.1473343518498; Thu, 08 Sep 2016 07:05:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.130.134 with HTTP; Thu, 8 Sep 2016 07:05:17 -0700 (PDT) In-Reply-To: <6F.26.45301.6BFADC75@pb1.pair.com> References: <6F.26.45301.6BFADC75@pb1.pair.com> Date: Thu, 8 Sep 2016 10:05:17 -0400 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a114d9b720d62ef053bff858e Subject: Re: [PHP-DEV] Single Point of Entry Apps. From: tendoaki@gmail.com (Michael Morris) --001a114d9b720d62ef053bff858e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Sep 5, 2016 at 1:47 PM, Andrea Faulds wrote: > Hi Michael, > > Have you looked into PHP application servers, where the PHP code itself > acts as the web (or FastCGI) server, and so can keep the whole framework > etc. initialised in memory between requests? > I have - it's what I was referring to when I mentioned PHP worker process trickery. I know it can be done, but it isn't straightforward and it can't be quickly applied to existing applications like Wordpress or Drupal. > > This is how other (non-PHP) web stacks avoid =E2=80=9Cinstalling the appl= ication > on every single request=E2=80=9D, and it can also be applied to PHP, it's= just not > very common. > I know. What I'm wondering though is, could there be a way to do this on the PHP engine level that would avoid massive rewrites of existing PHP code= . Here's my current draft of a way to implement this using two statements. require_bootstrap( [FILE] ); This statement loads and executes the code in question just as require does. It saves the execution state before moving to the next code line after this statement is called. If called without a file it saves the execution state immediately. The saved execution state is hostname aware for sites that use a multisite configuration. So if the statement is reached from www.onesite.com/index.php and from www.twosite.com/index.php two different bootstraps will be created. This is done on the assumption that the booting process is going to make one or more decisions based on the hostname. Drupal loads entirely different setting files, module lists, uses a different Dependency Injector, all according to the hostname. unload_bootstrap( [PATH] ); This unloads the bootstrap associated with the webpath given. If no argument is given the current bootstrap image is dropped. Question - should passing boolean TRUE unload all the bootstraps at once, or should that be it's own function, or is it necessary? Note that bootstraps will be unloaded automatically if the opcode cache for the associated files changes. Thoughts, suggestions, questions, complains, or flames? --001a114d9b720d62ef053bff858e--