TECH / Servers & Websites 2 min read

PHP Fatal Error: Call to Undefined Function gzinflate() – How to Fix

Antonio NEMCD Author
Published May 3, 2010 · 2 min

The error Fatal error: Call to undefined function gzinflate() (along with gzdecode() or gzuncompress()) means PHP was built or installed without the zlib extension. It most often shows up when moving a site onto a minimal VPS, FreeBSD server, or custom Docker image.

PHP logo

Checking whether the module is loaded takes one command, and enabling it usually takes just a couple of minutes.

Step 1. Verify If zlib Is Loaded

Check PHP’s active modules from the command line:

php -m | grep -i zlib

If nothing comes back, the extension is missing or disabled. Keep in mind that PHP CLI and your web server handler (PHP-FPM or Apache) can use different php.ini files, so double-check phpinfo() in the browser too if CLI shows it loaded.

Step 2. Install or Enable zlib

  • FreeBSD: install the matching extension package for your PHP version (for example PHP 8.3):
pkg install php83-zlib

(If you compile PHP from ports, make sure [X] ZLIB support is ticked in the build options.)

  • Debian / Ubuntu: official Debian/Ubuntu PHP packages normally compile zlib in by default. If you hit this on a custom build, make sure the system library zlib1g is installed:
sudo apt update && sudo apt install zlib1g
  • Windows (XAMPP / WAMP / standalone PHP): modern Windows PHP binaries include zlib built in – check disable_functions in php.ini to make sure gzinflate wasn’t explicitly blocked.
  • Docker (official PHP images): zlib is built into base images, while archive features using zip also require zlib1g-dev and docker-php-ext-install zip.

Step 3. Restart PHP-FPM or Apache

Reload your PHP handler so running workers pick up the newly installed module:

sudo systemctl restart php8.3-fpm   # or service php-fpm restart / service apache24 reload

On shared hosting without SSH access, open your control panel (cPanel / DirectAdmin -> Select PHP Version -> Extensions) and toggle zlib on, or ask support to enable it.

Related posts:

Leave a Comment