Error when gzip is enabled Topic is solved

Discussion regarding Joomla! 4.x Performance issues.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
theigloo22
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Mon Aug 15, 2022 9:58 pm

Error when gzip is enabled

Post by theigloo22 » Sun Dec 11, 2022 11:38 am

Hello :)

Can anyone shed some light on this, please

When I enable Gzip Page Compression, an error shows at the top of the page, both front end and back:
Deprecated
: explode(): Passing null to parameter #2 ($string) of type string is deprecated in
/home/customer/www/mydomain.com/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php
on line
406
Any clues?

I would like to use Gzip

J4.2.5 PHP 8.1.13

Thanks :D

gws
Joomla! Champion
Joomla! Champion
Posts: 5954
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Error when gzip is enabled

Post by gws » Sun Dec 11, 2022 11:52 am

Enable gzip in global config and remove all references for gzip in the .htaccess file.

theigloo22
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Mon Aug 15, 2022 9:58 pm

Re: Error when gzip is enabled

Post by theigloo22 » Sun Dec 11, 2022 11:53 am

Hi gws

yes that's what I did

I checked the .hteccess for any gzip stuff, but nothing there

gws
Joomla! Champion
Joomla! Champion
Posts: 5954
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Error when gzip is enabled

Post by gws » Sun Dec 11, 2022 11:58 am

In a standard J4 .htaccess you should have;
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist
# and the client accepts gzip.
RewriteCond "%{HTTP:Accept-encoding}" "gzip"
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]

# Serve gzip compressed JS files if they exist
# and the client accepts gzip.
RewriteCond "%{HTTP:Accept-encoding}" "gzip"
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]

<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header append Content-Encoding gzip

# Force proxies to cache gzipped &
# non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>

If you have this then just remove/comment out these lines.
If you do not have these lines then it is not a J4 standard .htaccess

theigloo22
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Mon Aug 15, 2022 9:58 pm

Re: Error when gzip is enabled

Post by theigloo22 » Sun Dec 11, 2022 12:04 pm

Here is what mine looks like, its an old site that started life a J1.5
should I just replace this with j4 default?

SetEnv PHPRC /home/customer/www/XXXX.sg-host.com/public_html/php.ini
##
# @package Joomla
# @copyright Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved.
# @license GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line 'Options +FollowSymLinks' may cause problems with some server configurations.
# It is required for the use of mod_rewrite, but it may have already been set by your
# server administrator in a way that disallows changing it in this .htaccess file.
# If using it causes your site to produce an error, comment it out (add # to the
# beginning of the line), reload your site in your browser and test your sef urls. If
# they work, then it has been set by your server administrator and you do not need to
# set it here.
##

## No directory listings
IndexIgnore *

## Can be commented out if causes errors, see notes above.
Options +FollowSymlinks
Options -Indexes
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
</IfModule>
## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site then comment out the operations listed
# below by adding a # to the beginning of the line.
# This attempts to block the most common type of exploit `attempts` on Joomla!
#
# Block any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mywebsite.com.au [NC]
RewriteRule ^(.*)$ https://www.mywebsite.com.au/$1 [L,R=301]
#
## End - Custom redirects

##
# Uncomment the following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##

# RewriteBase /

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 82.40.48.210

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

gws
Joomla! Champion
Joomla! Champion
Posts: 5954
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Error when gzip is enabled

Post by gws » Sun Dec 11, 2022 12:06 pm

Yes replace with a standard J4 one and if necessary remove the lines discussed previously.

theigloo22
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Mon Aug 15, 2022 9:58 pm

Re: Error when gzip is enabled

Post by theigloo22 » Sun Dec 11, 2022 12:09 pm

OK thanks for your help :)


Locked

Return to “Performance - Joomla! 4.x”