Newsgroups: php.general,php.internals Path: news.php.net Xref: news.php.net php.general:325696 php.internals:95468 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44135 invoked from network); 28 Aug 2016 00:32:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Aug 2016 00:32:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=rene.veerman.netherlands@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rene.veerman.netherlands@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.177 as permitted sender) X-PHP-List-Original-Sender: rene.veerman.netherlands@gmail.com X-Host-Fingerprint: 209.85.216.177 mail-qt0-f177.google.com Received: from [209.85.216.177] ([209.85.216.177:34844] helo=mail-qt0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/E9-34481-D0132C75 for ; Sat, 27 Aug 2016 20:32:14 -0400 Received: by mail-qt0-f177.google.com with SMTP id 93so54256810qtg.2; Sat, 27 Aug 2016 17:32:13 -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 :cc; bh=+0w6vRmqRL4O81ExZ/fLVhsH9FSaRfsOC5alI3ZGeB8=; b=B7vxSh/j8sSdtEXlWy4Ed4yoH5azwsGzQkRoYxo3YAizWEuesPRAwgP/RDuDQz7VwP 8FadXxHlzEjlHs7GHERZ17oJYYWav/m7QE+7WFh3RP6HddHzzDlJ1mGOce8H/6Kt5f7D 5gtZuKF53iakKDy/eEEbIshpTb+Kw7Ee456sn3STfyVYMQujDiSwi88rrnN+2XRBIww3 z7ONpVW/9mOZEBXpE5Iv6MgvTynLLCuFLmPM0+QXA52h1ES1pifj8dphlqN1W2CAkVgQ Maf6M4U2984MPj55iohwwb0rNwpv3M/cgU7EMhbYezURkAZ/9ogdDCf3mJd2syWpcHOM F20w== 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:cc; bh=+0w6vRmqRL4O81ExZ/fLVhsH9FSaRfsOC5alI3ZGeB8=; b=CmuZaaHlV8kn4u7RMaUg/sV55GvBjg3Xk5M0Om5dwrDvlbIIj8F3+bB8b8qnn6gwRF w9T6fKSbN90RtPxn50rZ1gnfjGRLs066VI5zaZSFXTUy05OgLSG/eAo/WNepXFlUZBNf 14y3CG6Y34sVHn9OjDLRyOrYvvI8JvfVNh4IDWTmZs+7FiiPnxf+tBkgXmQbZkW69a5g ujtoGc3kaMoDtgB0QO2ONgF64Q4POZd2gLxeL0pd2K9zZGUuI3aLp/Ru1BS0WDUlK7mN itn1VJHvaoYB+tAOF6uyAwCEecZUvs4jYOykdYH9j8PWIN9wYKfplhBkphPZrS6xN53k E8Ow== X-Gm-Message-State: AE9vXwNs5H2w3N3ZbRPAczDKzqbxEMchysrZClbgxDjFYOIure9sfFveLasDQafGQ/VAU9cICVTpzyR8sVaywA== X-Received: by 10.200.52.193 with SMTP id x1mr10972238qtb.65.1472344330779; Sat, 27 Aug 2016 17:32:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.52.68 with HTTP; Sat, 27 Aug 2016 17:31:50 -0700 (PDT) In-Reply-To: <3B285FFA-4C62-421D-A5B5-E5F205C53C02@gmail.com> References: <5E615A59-AC2B-455F-9438-D295419F3767@ashleysheridan.co.uk> <33E6F0A8-A14B-4590-A18C-FF6D6E029D0A@gmail.com> <3B285FFA-4C62-421D-A5B5-E5F205C53C02@gmail.com> Date: Sun, 28 Aug 2016 02:31:50 +0200 Message-ID: To: Joshua Kehn Cc: Ashley Sheridan , php-general@lists.php.net, internals@lists.php.net Content-Type: multipart/alternative; boundary=001a11475786d2c405053b16e08c Subject: Re: [PHP] feature request : gzip caching From: rene.veerman.netherlands@gmail.com (Rene Veerman) --001a11475786d2c405053b16e08c Content-Type: text/plain; charset=UTF-8 On Sat, Aug 27, 2016 at 9:36 PM, Joshua Kehn wrote: > Apache handles gzipping just fine. http://httpd.apache.org/ > docs/current/mod/mod_deflate.html > > and my PHP handles static file serving only when needed, when evaluating > content and js for specific URLs > > > I'm not sure why that would be required. Why doesn't the HTML reference > the assets required directly? > that would result in *way* too many HTTP requests dude ;) i'm thinking i evaluate what URL is called up in PHP, figure out what cache files are needed (i now use multiple stages of cache files for some stuff like the main HTML template), and output a new "master cache file" that is a file that gets called up rather quickly with readfile() after a file_exists(translateURLtoFilesystempath($untranslatedContentURL)) to see if regeneration for any particular URL is needed.. public function translateURLtoFilesystempath ($url) { $r = $url; $r = str_replace('/','---',$r); $r = str_replace('?','-_-',$r); $r = str_replace('&','__-',$r); $r = str_replace('=','___',$r); return '--_'.$r; } public function translateFilesystempathToURL ($path) { $r = preg_replace ('#.*--_#', '', $path); $r = str_replace('---','/',$r); $r = str_replace('-_-','?',$r); $r = str_replace('__-','&',$r); $r = str_replace('___','=',$r); return $r; } > > and for noobish developers it might be very convenient to add this to php > readfile() afterall > > > Convenient and right are often two different ways to solve a problem. I > try to not offer convenient solutions that are not right. > yea, that's the C++ attitude ;) you do know C++ got dinosaured for a *more simple and intuitive* C# right? ;) > > --jk > > On Aug 27, 2016, at 3:04 PM, Rene Veerman gmail.com> wrote: > > yea ok.. "something upstream".. is that nginx easy to stack above / next > to / under apache2? i'm really used to apache2.. > and for noobish developers it might be very convenient to add this to php > readfile() afterall.. > > and my PHP handles static file serving only when needed, when evaluating > content and js for specific URLs to fit in a common HTML site template for > instance.. > you know of a better way? i'm all ears :) > > On Sat, Aug 27, 2016 at 9:00 PM, Joshua Kehn wrote: > >> Why is PHP handling static file serving? This is squarely outside of it's >> domain. Have nginx or something upstream handle gzipping content. >> >> --jk >> >> > On Aug 27, 2016, at 1:22 PM, Rene Veerman < >> rene.veerman.netherlands@gmail.com> wrote: >> > >> > eh no, i'm a big fan of caching output in js / json cache files :) >> > but those still need to get gzipped... not just my main JS file, also my >> > photoalbum contents -> another 1Mb of JSON content... >> > >> > On Sat, Aug 27, 2016 at 7:19 PM, Ashley Sheridan < >> ash@ashleysheridan.co.uk> >> > wrote: >> > >> >> >> >> >> >> On 27 August 2016 17:52:48 BST, Rene Veerman > >> gmail.com> wrote: >> >>> Hi.. >> >>> >> >>> First off, i love PHP. Many thanks for keeping it free too. >> >>> >> >>> However, i've noticed that gzipping the 1Mb of javascript that my >> >>> seductiveapps.com needs, takes a relatively long time (measured over >> a >> >>> total page load time which i'd like to bring down from it's current 10 >> >>> seconds, about a second or even more is spent gzipping (by a core i5 >> >>> machine)).. >> >> >> >> Are you building the js each time it's requested? Have you thought >> about >> >> building it as a deployment step for production? >> >> >> >>> >> >>> At one time, i spent time building PHP code that cached the >> >>> already-gzipped >> >>> content and outputted that with just readfile().. But i never got it >> to >> >>> work a second time, unfortunately.. >> >> Why don't you want the web server to handle the gzip side of things? It >> >> would make more sense surely? >> >> >> >>> Could you pretty please add this to the core of PHP? Shouldn't be that >> >>> hard >> >>> for the internals team right?.. >> >>> >> >>> Many thanks in advance for even considering to do this.. >> >>> >> >>> with regards, >> >>> Rene Veerman, >> >>> CEO + CTO of seductiveapps.com >> >> >> >> -- >> >> Sent from my Android device with K-9 Mail. Please excuse my brevity. >> >> >> > > --001a11475786d2c405053b16e08c--