/go/zliboutputcompression changes the PHP setting zlib.output_compression in every php.ini file on the server. When the setting is on, PHP compresses the pages it produces (with gzip or deflate) for browsers that accept compressed content. This makes pages smaller and faster to download. It: The setting works together with compression done by the web server. See gzip. If both are on, the responses are compressed in PHP, and the web server normally leaves them alone, so it is enough to use one of the two. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# Check the current value
/go/zliboutputcompression return
# Turn it on
/go/zliboutputcompression On
# Turn it off
/go/zliboutputcompression Off
Arguments
| Argument | Required | Default | Notes |
|---|---|---|---|
[value] |
No | On |
Use On, Off, or a whole number. The value is not validated, and if you pass several words they are joined with spaces. |
return |
No | — | Prints the current value. Not case-sensitive. |
The command has no other options.
Files changed
Only files that exist are changed.
| System | Files |
|---|---|
| AlmaLinux, Rocky, CentOS, Red Hat, Fedora | /etc/php.ini and /etc/opt/remi/<version>/php.ini for each installed version |
| Debian, Ubuntu | /etc/php.ini and, for each installed version, /etc/php/<version>/fpm/php.ini, /etc/php/<version>/cli/php.ini, and /etc/php/<version>/apache2/php.ini |
Examples
# Read the current value
/go/zliboutputcompression return
# Turn compression on for the whole server
/go/zliboutputcompression On
# Turn it off again
/go/zliboutputcompression Off
# Check the result on a Debian or Ubuntu server
grep -H '^zlib.output_compression' /etc/php/*/fpm/php.ini
# Check the result on an AlmaLinux, Rocky, or CentOS server
grep -H '^zlib.output_compression' /etc/opt/remi/*/php.ini
# Check that a page is compressed
curl -s -H "Accept-Encoding: gzip" -D - -o /dev/null https://example.com/ | grep -i content-encoding
Output
| Outcome | What you get |
|---|---|
return |
The current value, such as Off, from the first file found. Empty if that file has no zlib.output_compression line. Exit code 1. |
| Value set | Zlib Output Compression updated successfully. |
| Unsupported operating system | Unknown operating system. |
The confirmation line is printed even if no php.ini was found or changed. The command doesn’t list the files it edited.
Logging
Every run is appended to /var/log/go/zliboutputcompression.log.
See the full reference at /go/zliboutputcompression and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
