Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95653 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81508 invoked from network); 5 Sep 2016 16:03:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2016 16:03:27 -0000 Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.176 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.217.176 mail-ua0-f176.google.com Received: from [209.85.217.176] ([209.85.217.176:36495] helo=mail-ua0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/52-45301-E479DC75 for ; Mon, 05 Sep 2016 12:03:26 -0400 Received: by mail-ua0-f176.google.com with SMTP id 49so45488016uat.3 for ; Mon, 05 Sep 2016 09:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=Q9vL0twOQ9qRSpWhCyYDOVGHkGYAVB68yK8VvNzLmik=; b=bBaLVae1WxwpAhJYua3+bJHd0oFyjgzaqsUo6oO0Jvr6wPUDZcinhmopXrxGZI0WEF mffDyyGidII7PcLidCkkOmDax8APwO508zetMpphYxHaDwQ5V38vAC9tL7MscZWX6XY1 JEuoaB4aX4ccXN0rtAzpX0QyGdxQMXKaEYjPKnzFDkbYJ3uSe2dCijQROl4wwzlEtauR rHKV1TIlDShqwk3DqV4zTPm6+6FIGd1k1JWV2fpeL/7nJUzx7EShs5hXnBGnacyGyJLC QpetXoCDEmmtgCI5//zTuXQ0yXSd37Cw2sM+RgZe2e2iaGELv52wYnnuAA3jBYlo7dyn 0KBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Q9vL0twOQ9qRSpWhCyYDOVGHkGYAVB68yK8VvNzLmik=; b=WKHTyJFACCfxACQ02iMihWuG3gthym3vtU7WEMywlm79w/ikD2mmxn9TzyqGqohzv7 oftHjY4Keowd4pBTOp+QWkXSdVV3AqMX78sbTTKgZJaLqAigNW+nxcD2NdZMS+ckGyB6 4Y/ev2/MgYkc957yzKpapRkHw5juX4YPvqPKTQpwUZCTOl0ugRZCWVyAm+bitnqpPFrM XqJB5Gs2zw53fZ/l/l9cTPHFPrAsZO1Iq+BbtjnsdG8ISTe0mJQfGH/Utq0yD7vKcqxM fDpkqY2Ldv8i7kprg01/PV9pRIQY+/cE8u0qBkE3xeGTYcozl/kg0pxglORdOebjSwMR MMIg== X-Gm-Message-State: AE9vXwOS8fu6IaAa2KjNX3N5l+EaUUOwPHQwJRrJpjHQHYsfoJOtsjEPPmsc7pky6e3JuonH3X9E2tWq/VNnCg== X-Received: by 10.176.67.7 with SMTP id k7mr23178302uak.23.1473091403113; Mon, 05 Sep 2016 09:03:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.130.134 with HTTP; Mon, 5 Sep 2016 09:03:22 -0700 (PDT) Date: Mon, 5 Sep 2016 12:03:22 -0400 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a114dfb1acde901053bc4d1b4 Subject: [PHP-DEV] Single Point of Entry Apps. From: tendoaki@gmail.com (Michael Morris) --001a114dfb1acde901053bc4d1b4 Content-Type: text/plain; charset=UTF-8 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. --001a114dfb1acde901053bc4d1b4--