Question

Missing zlib extensions on Ubuntu

Posted February 22, 2015 11.4k views

I have a Wordpress install on a 512Mb Ubuntu 14.04 x32 which is working fine 95% of the time, however I occasionally get this error when both browsing and working in the Admin panel:

Abort class-pclzip.php : Missing zlib extensions

URL here

Can anyone help me identify what this might be? My guesses at this stage are pointed towards a plugin dependency, or php extensions but I want to confirm before playing with the config.

Cheers,
Andy

3 comments
  • It seems some plugin is trying to use class-pclzip.php to compress or extract an archive. It might be a bug in the plugin or a missing dependency. Though, Zlib support should exist by default in Ubuntu. On the command line, what’s the output of:

     php -r 'var_dump(function_exists("gzopen"));'
    

    It should show bool(true) if the zlib extension is available.

  • I am having the exact same issue.

    When I run:

    php -r 'var_dump(function_exists("gzopen"));'
    

    in the command line, it returns bool(false).

    I ran:

    sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev
    

    to make sure zlib is installed properly, but it’s still bool(false)

    Any suggestions on how to fix this?

  • I did the same thing, its still the same.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

For wordpress create a file /wp-content/mu-plugins/gzopen.php with the content:

if (!function_exists('gzopen') && function_exists('gzopen64')) {
    function gzopen($filename , $mode = 'r', $use_include_path = 0 )
    {
        return gzopen64($filename , $mode, $use_include_path);
    }
}
Submit an Answer