Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95654 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84940 invoked from network); 5 Sep 2016 16:15:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2016 16:15:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.21 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.21 mout.gmx.net Received: from [212.227.17.21] ([212.227.17.21:65243] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/B2-45301-43A9DC75 for ; Mon, 05 Sep 2016 12:15:49 -0400 Received: from [192.168.2.103] ([79.243.115.246]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0Lip2P-1b41yW0MoP-00d0MS; Mon, 05 Sep 2016 18:15:45 +0200 To: Michael Morris , internals@lists.php.net References: Message-ID: <91b9f8b2-906a-72c9-0960-047efca52028@gmx.de> Date: Mon, 5 Sep 2016 18:16:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:MquZt0JINVYEsSF8dx9l00EhLznw+m55cPzmqxNPokz69McA3ko Qr8WEXdk6aEac+ul2RSV/qOOILTOPARxgH2Wb53SxQ9UCq39vBVsUL1z3Ih+/9Y8KEZJZXp nFPhfgIe4OUCp6Xpto292YaTSGd1z7+Da4D2O5Sr28SUqZOA5Z1potlHk7HaqxFWp6VEWjw TcvPIzGBfCoglXs1+/e3A== X-UI-Out-Filterresults: notjunk:1;V01:K0:tTQCnvWPdEM=:uLffKZFj/OJ87OUXZHZhLl womwqFNfGr7y82PWpm2mRjauXo/jpC7knMY9+qD9LEBCvGaDJ/ewhE9ifzR8tJS+Lkmw1RRWA U0ZBUN+5v08sAlYllpx/hm9jh3cejR3aoHilxVgR9mykfBa721It6coJD0KB/yI79Y9PkGGnB 50mZ7LS7PEJvYwlj+k9qErEm+5kccooDNQhlZkXI5qTmyRMDaW/uwkxMejHxZ+OeBjpMQpaLO B5VZ5ORVUC1cWkg6FDx/1f56f0pq58oZbNVivMoF0YZ6ywZ+5kFpmJXV1Pg6GnoRQ2prasi+y pDuRo06+gpebgcMLTjna69oSJ0IxUeQ5ydo3g1aVdmIbO5C1MnfI0LJED5s0wyUWfr4CapIMo Nzku6ijj6gIKe3+pGzgFj8NPDDX83RqPXc/T3vG6jizLYUJtV7QqIuRndqvqntZAqCU3oNMcS /HRatC2GEOaudMI6jBQ2OjnUv3IL6BM4GfFEZU94nYg+qsS+EcTPMQGYV0EJ33y7fR/ILqQWP f503DkQKpNMroTFriE4uv7iJvbOzBvjsHnmOpwWOdaCWguk7Mjny2pB4/4iRSTVeIPIuulGG5 cMVq+xSQEFNYOryT3MXAGDVxM4nnAGrK4OjHjWJt5BuAJnn0kZ5jHVzwMTADU9DHe4bRJ/AWP /BQtVI73mF4q1gu5Z5W4sBtyq/yzlaUQMboYhwjipP17aYhEQkYJPzg6I0UUUm5X8uuNHbSmd sG5iwsC7tP4fiA6MciNhHx2hVgwPpyTm8AOPiQBkN5LVqUpokvwrWWe0Q+EjMUtN2a6Yc91EI GaDUKwv Subject: Re: [PHP-DEV] Single Point of Entry Apps. From: cmbecker69@gmx.de ("Christoph M. Becker") On 05.09.2016 at 18:03, Michael Morris wrote: > Something I was reminded of during the discussion of replacing pear with > composer that I thought was worthy of it's own thread. Most PHP apps I've > seen that use composer are > single point of entry apps - that is there's one front controller, usually > index.php, and .htaccess rules are put in place that route all requests to > that file. > > These apps then go through the process of initializing themselves and > sometimes there are thousands of lines of code that get parsed through > before the app is in ready state, the router finally loaded and a decision > is made concerning the user's request. > > This is extremely inefficient > > What can be done in PHP core to more effectively embrace this paradigm > without disturbing the current one? That's what this thread is to > discuss. Here's my stab at it. > > Create an .htaccess directive that allows a php file to be a directory > handler. When that directive is set the webserver will pass any > non-existent file request to PHP (in effect becoming a one line replacement > for a very common usage of mod_rewrite). > > When this directive is used two statements will be looked for by the > runtime - first a ready statement (not necessarily named "ready"). When it > is reached PHP will save the application state, clone it and continue > working from the clone. On all all subsequent requests to the directory PHP > will start by creating a new clone and working from there. > > The second statement instructs PHP to drop the saved state and load a new > one starting with the next request (graceful) or to kill any concurrent > workers (panic) > > This isn't the same as opcode caching - this would be caching of the entire > application state including any data harvested from config file reads or > database calls. > > It is possible to create this setup now using some PHP worker process > trickery, but it isn't easy. > > Again, the above may not be a possible solution - but there's got to be a > better way than the current approach which amounts to installing the > application on every single request. > > Thank you all for your time. Not long ago (something like) this has already been proposed, see ff. -- Christoph M. Becker