PHP Fatal error: Call to undefined function gzinflate()

last updated in Categories , , , , , ,

I have a php script and whenever I run it, I get the following error message in my log file:
     2017/02/05 23:25:46 [error] 9696#9696: *10 FastCGI sent in stderr: “PHP message: PHP Fatal error: Call to undefined function gzinflate() in /home/xxxx/http/includes/functions.php(1) : eval()’d code on line 1″ while reading response header from upstream, client:, server:, request: “GET /a/ HTTP/1.0”, upstream: “fastcgi://”, host: “”
How do I fix this problem on Alpine Linux or Unix operating systems?

You need to use Zlib. The Zlib support in PHP is not enabled by default. You will need to configure PHP –with-zlib[=DIR]. The Windows version of PHP has built-in support for this extension. You do not need to load any additional extensions in order to use these functions. However, on Linux or Unix you need to install php5-zlib or php7-zlib as per your distro.

Install php5-zlib or php7-zlib on Alpine Linux

# apk add php5-zlib
# apk add php7-zlib
You must restart php-fpm or apache/lighttpd process:
# rc-service php-fpm restart
# /etc/init.d/php-fpm restart

Install php56-zlib on FreeBSD

Type the following command:
# pkg install php56-zlib
# pkg install php70-zlib
Make sure you restart the php-fpm:
# service php-fpm restart


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

2 comment

  1. I hope you read the code first.

    > eval()d code on line 1

    This means the code was misunderstood being rung through the `eval` function.

    There is absolutely no excuse for having this anywhere ever. At best, it’s a security vulnerability waiting to happen. At worst, it’s one that’s happening right now.

    I would seriously consider rewriting your code to not use eval, and then turn it off all together.

    Still, have a question? Get help on our forum!