Before asking for help please read "How to request help" by clicking on that tab above here.
  • Page:
  • 1
  • 2

TOPIC:

gzip compression 3 months 1 day ago #1

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
For my webtrees website I have set gzip compression.
In webtrees 1.7 it worked OK but it does not work in 2.0.
Could there be some conflict with webtrees?
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit

Please Log in or Create an account to join the conversation.

Last edit: by jprause.

gzip compression 3 months 2 hours ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14084
How did you set gzip compression?

What does not work? Do you get an error? Can we see this?
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

gzip compression 2 months 4 weeks ago #3

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
There are no errors in website log.
My settings:

File .htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !^.*on
RewriteRule ^(.*)$ www.jprodina.cz/$1 [R,L]
#
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L]
#
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/font-sfnt
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/html
</IfModule>

File user.ini:

zlib.output_compression = On
display_errors = On

HTML is not compressed.

Appendices:

PHP setting see image php-7.4.12.jpg

test gzip with www.gidnetwork.com/tools/gzip-test.php see image gid_network-test.jpg

browser chromium debugger see image browser-debugging.jpg
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit
Attachments:

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #4

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14084
Does it help if you add this line:

AddOutputFilterByType DEFLATE application/x-httpd-php
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #5

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
No this does not help, sorry.
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #6

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14084
Then I am afraid I do not know.

I read that PHP scripts are handled separately from other files - which is why your DEFLATE rules do not work.

Perhaps it is necessary to add DEFLATE options to the configuration that handles PHP scripts...
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #7

  • ddrury
  • ddrury's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 303
--
Dave

Local: Win 10 Pro/WSL Ubuntu 18.04.4, Nginx 1.14.0, PHP 7.4.5/7.3.17-1, Mysql 5.7.29-0ubuntu0.18.04.1
Production: Apache 2.2, PHP 7.3.15, 10.3.18-MariaDB

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #8

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
At this moment I'd only like to note that under my domain there are a few other subdomains:
besides webtrees 2.0 there are two WordPress sites, two Mediawiki sites and one Piwigo.
All of them are successfuly gzip compressed.
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit

Please Log in or Create an account to join the conversation.

Do you need a web hosting solution for your webtrees site?
If you prefer a host that specialises in webtrees, the following page lists some suppliers able to provide one for you: 

gzip compression 2 months 3 weeks ago #9

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
I sent the issue to my webhosting support. Waiting for reply.
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #10

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14084
Does it make a difference if you disable "pretty URLs"?
e.g. update data/config.ini.php and remove .htaccess
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #11

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
There is no difference between "pretty" and "ugly" URLs.
Btw, only the content-type text/html is not compressed. Content-types text/css and application/javascript are gzip compressed.
I think you could see it in your browser.

EDIT:
hosting support asks me whether there is something like
header('Content-Encoding: gzip');
in webtrees code.
I do not know.
I tried to find the string "gzip" in webtrees code.
It only matches 11 times in folder "vendor" but this is far beyond my PHP knowledge.
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit

Please Log in or Create an account to join the conversation.

Last edit: by jprause.

gzip compression 2 months 3 weeks ago #12

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14084
> hosting support asks me whether there is something like
> header('Content-Encoding: gzip');

No. This is normally added by the webserver (apache/nginx)
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

gzip compression 2 months 3 weeks ago #13

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
I have installed webtrees 1.7.17 on the same server with the same .htaccess and .user.ini settings.
On this website (i.e. test.jprodina.cz ) gzip compression works as expected.
(See picture)
I guess there must be some difference in some code in folder /vendor/guzzlehttp (this is a black box for me) between 1.7 and 2.0 as to the html compression.
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by jprause.

gzip compression 2 months 2 weeks ago #14

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
I have installed webtrees 2.0.10 URL test.jprodina.cz/tree/nase-rodina.
There are no third-party modules, no CSS&JS modification.
Settings in .htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !^.*on
RewriteRule ^(.*)$ test.jprodina.cz/$1 [R,L]
#
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L]
#
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/font-sfnt
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/html
</IfModule>

In .user.ini:

zlib.output_compression = On

This are recommended settings for gzip compression.

The result is that "content-type: text/html" are not compressed whereas css and javascript are compressed, see appendices.

The hosting support says that the application webtrees is somehow blocking text/html compression.

Can you help please?
May I ask somebody of the webtrees community to try to set gzip compression for their webtrees 2.0.10 website and share their experience?
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by jprause.

gzip compression 2 months 1 week ago #15

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14084
I do not have an apache server for testing - but I have no problem compressing output using nginx.

Does it help if you add a line to your .htaccess:

<IfModule mod_deflate.c>
Header unset Content-Length
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

gzip compression 2 months 1 week ago #16

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
No, this does not help.
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit

Please Log in or Create an account to join the conversation.

gzip compression 2 months 1 week ago #17

  • ddrury
  • ddrury's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 303
This topic prompted me to investigate Apache's implementation of compressing or chunking output and to my mind it does a pretty good job and certainly not something to get hung up about, however I did look at github.com/h5bp/html5-boilerplate/blob/m.../dist/.htaccess?ts=2 which has a lot of stuff in it and some bits that I found useful.

1. Implemented removal of ETag
2. Added far-future expiration dates.

Adding these lines really improved the responsiveness of the site, all the static stuff gets cached and the remainder either benefits from chunking or is small enough to get compressed.

I initially added the content transformation lines
<IfModule mod_headers.c>
     Header merge Cache-Control "no-transform"
</IfModule>
but that made the site really slow - for some reason my host really didn't like that and caching went wrong.
--
Dave

Local: Win 10 Pro/WSL Ubuntu 18.04.4, Nginx 1.14.0, PHP 7.4.5/7.3.17-1, Mysql 5.7.29-0ubuntu0.18.04.1
Production: Apache 2.2, PHP 7.3.15, 10.3.18-MariaDB

Please Log in or Create an account to join the conversation.

gzip compression 2 months 1 week ago #18

  • ddrury
  • ddrury's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 303
A bit more (not exhaustive) investigating reveals an interesting difference between wt1.7 & wt2.0. Using Firefox on my test system and loading my own individual page, the developer tools show for the individual.php line for wt1.7.17 9.70k transferred for a size of 47.69k. For wt2.0.10 the data is 28.25k and 260.07k - whilst still relatively small amounts there is a significant increase for wt2.0.

It seems likely that there are instances in wt2.0 where Apache's DeflateBufferSize (default is 8k) is exceeded resulting in the transfer being chunked where in 1.7 it falls below the limit
--
Dave

Local: Win 10 Pro/WSL Ubuntu 18.04.4, Nginx 1.14.0, PHP 7.4.5/7.3.17-1, Mysql 5.7.29-0ubuntu0.18.04.1
Production: Apache 2.2, PHP 7.3.15, 10.3.18-MariaDB

Please Log in or Create an account to join the conversation.

gzip compression 1 month 3 weeks ago #19

  • eh215
  • eh215's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 228
jprause - you raised this topic a few weeks ago but it looks like your site is still having issues trying to compress some components.

Here is what I have in my Apache .htaccess file to turn on compression and caching. While I have not tested every possible page, all of my spot-checks show that both compression and caching are being applied as expected.

I originally set the compression up by specific file type but have since modified it to compress by default as shown below. It might need updating if I hosted a wide variety of media types (sound, videos, etc) but I have no plans for that so it works for the content that I have. I am also on 2.0.10.
#
#Compress everything except images
#
<ifModule mod_deflate.c> 
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|pdf)$ no-gzip dont-vary
</ifModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 12 month"
</IfModule>
webtrees 2.0.10 at behunt.net/ft
PHP 7.4.8, MySQL 5.7.23-23

Please Log in or Create an account to join the conversation.

Last edit: by eh215.

gzip compression 1 month 3 weeks ago #20

  • jprause
  • jprause's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 197
@eh215:
I tested your .htaccess setting on my testing site .
Alas the "content-type: text/html" components are still not gzip compressed.
Josef

webhosting:-- webtrees 2.0.11, PHP version 7.4.14, MySQL 5.7.21, testing webtrees 2.0.11
local desktop:-- webtrees 2.0.12-dev, PHP version 7.4.3, MySQL 8.0.21, Apache2 2.4.29, Linux Ubuntu 20.04 64bit

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum