• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question How to install Brotli extension for PHP 7.4.x with Ubuntu 20.4.1 LTS ?

Automata

Basic Pleskian
Hi,

Operating system:
Ubuntu 20.04.1 LTS

Plesk version:
Plesk Obsidian v18.0.33_build1800210123.00

PHP version:
7.4

Server type:
NGINX only


I have already googled and tried all the existing guides but unfortunately none seem to work.

So i kindly ask for help on how to install Brotli extension for PHP 7.4.x with Ubuntu 20.4.1 LTS on Plesk Obsidian v18.0.33_build1800210123.00 on NGINX only server.

Brotli extension for PHP is required for web sites developed with WordPress and using the W3TC (W3 Total Cache) plugin which currently has over 1 million active installations on WordPress..

At this link you can find the discussion on the official W3TC (W3 Total Cache) plugin support forum on WordPress.org :

Brotli Compression Installed But Not Available In W3TC

This is the explanation given by one of the developers / support agents of W3TC (W3 Total Cache) plugin for WordPress:

"We check for the PHP function brotli_compress because that function is used to compress cache files and store a compressed version of the cache, the same as we do for gzip compression. If we would not do this, the server has to dynamically compress files when requested, which takes some time. That would defeat the purpose of using compression to speed up the website.
This means that you need to install a PHP module Brotli so that Brotli can be enabled in W3 Total Cache"

So they suggest using this PHP extension which is actively supported and maintained:


https://github.com/kjdev/php-ext-brotli

I would like to thank in advance anyone who wants or can help me now.
 
@Automata you can try to use this method:

Code:
# apt-get install plesk-php74-dev make gcc git
# git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
# cd php-ext-brotli
# /opt/plesk/php/7.4/bin/phpize
# ./configure --with-php-config=/opt/plesk/php/7.4/bin/php-config
# make
# cp /root/php-ext-brotli/modules/brotli.so /opt/plesk/php/7.4/lib/php/modules/
# echo "extension=brotli.so" > /opt/plesk/php/7.4/etc/php.d/brotli.ini
# plesk bin php_handler --reread

After that, you can check that brotli PHP module is loaded:

Code:
# /opt/plesk/php/7.4/bin/php -m | grep brotli
brotli
 
Back
Top