Announcement

  •  » Requests
  •  » Fix for ZLib issues on Ubuntu (and other OS's)

#1 2014-05-09 06:54:47

kohenkatz
Member
2014-05-09
3

Fix for ZLib issues on Ubuntu (and other OS's)

Hello,

When I installed Piwigo and then tried to install some plugins, I kept getting the message:

    Abort pclzip.lib.php : Missing zlib extensions

Running `php -m` showed that the Zlib extension was, in fact, installed.

This is similar to the problem mentioned in this topic (though the solution proposed in that topic does not work for the reason claimed - it actually works because PHP is compiled against a different version of Zlib.)

The root of the problem lies in the fact that PHP compiled with "large file support" (as PHP on new Ubuntu installs is compiled) names the function `gzopen` as `gzopen64` instead.  Piwigo looks for the original function name, and then complains when it cannot be found.

The simplest solution for this problem is to check whether the function exists, and to alias it if it does not.  For example, like this:

Code:

if (!extension_loaded('zlib'))
    {
      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
    }
    if (!function_exists('gzopen') && function_exists('gzopen64'))
    {
      function gzopen(string $filename , string $mode, int $use_include_path = 0) {
        return gzopen64($filename, $mode, $use_include_path)
      }
    }

Another way to do it would be to use a function pointer, like this:

Code:

if (!extension_loaded('zlib'))
    {
      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
    }
    if (function_exists('gzopen'))
    {
      $this->gzopen_func = 'gzopen';
    }
    elseif (function_exists('gzopen64'))
    {
      $this->gzopen_func = 'gzopen64';
    }
    else
    {
      die('Abort '.basename(__FILE__).' : Could not find gzopen');
    }

Then, instead of saying `gzopen(...)`, you would use this:

Code:

$gzopen = $this->gzopen_func;
$gzopen(...)

(Note that this could probably be done in a single line - I just did it in two lines for clarity about what points where.)

Note that I had this issue on Ubuntu, but I found similar reports about gzopen64 on many platforms.

Piwigo version: 2.6.2
PHP version: 5.5.9-1ubuntu4
MySQL version: 5.5.37-MariaDB-1~trusty-log
Piwigo URL: https://ph05.10815.net/photos

Last edited by kohenkatz (2014-05-09 06:56:10)

Offline

 

#2 2014-05-09 10:28:06

flop25
Piwigo Team
2006-07-06
7037

Re: Fix for ZLib issues on Ubuntu (and other OS's)

Hello
thx for reporting
please open a ticket http://piwigo.org/bugs/


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2014-07-18 23:20:22

Tiny Tony
Guest

Re: Fix for ZLib issues on Ubuntu (and other OS's)

Wow, kohenkatz!!! thank YOU!!!

I basically had the SAME problem with Piwik update and couldn't figure it out. Installed the module but no luck.

The moment I read "The root of the problem lies in the fact that PHP compiled with "large file support" (as PHP on new Ubuntu installs is compiled) names the function `gzopen` as `gzopen64` instead."  -- I was like...AHA!

nothing a little grep action couldn't figure out the locations of the gzopen module call and we're in business!!

 

#4 2014-07-25 17:22:53

moorezilla
Member
Massachusetts
2014-07-25
8

Re: Fix for ZLib issues on Ubuntu (and other OS's)

This helped me as well. Thanks!

Offline

 

#5 2014-08-10 07:20:51

plainhavoc
Guest

Re: Fix for ZLib issues on Ubuntu (and other OS's)

Hi,

I'm sorry to ask this, but I'm a bit lost as to which file and where to edit to correct this issue. Could someone explain a bit more?

Editing files no big deal but when it comes to compiling (at least the term) I get lost easily.

 

#6 2014-08-10 12:55:33

flop25
Piwigo Team
2006-07-06
7037

Re: Fix for ZLib issues on Ubuntu (and other OS's)

this has been targeted for 2.7 beta 3


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2014-09-26 11:32:47

nec
Member
2014-09-26
12

Re: Fix for ZLib issues on Ubuntu (and other OS's)

flop25 wrote:

this has been targeted for 2.7 beta 3

I'm (honestly) wondering how you will manage to upgrade the upgrade plugin when the upgrade plugin is broken?

(i mean, except manual upgrade)

Offline

 

#8 2014-09-26 11:37:09

flop25
Piwigo Team
2006-07-06
7037

Re: Fix for ZLib issues on Ubuntu (and other OS's)

That's not the plugin,  that's the core. So the only solution is manual update. This basically means overwriting files and launching the upgrade page


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#9 2014-09-28 16:38:17

nec
Member
2014-09-26
12

Re: Fix for ZLib issues on Ubuntu (and other OS's)

Have a look at that related issue:

[Github] dokuwiki issue #865

Offline

 

#10 2014-10-06 12:46:56

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Fix for ZLib issues on Ubuntu (and other OS's)

Issue fixed for the upcoming Piwigo 2.7.1, see [Subversion] r29904

Offline

 

#11 2014-10-06 13:20:19

nec
Member
2014-09-26
12

Re: Fix for ZLib issues on Ubuntu (and other OS's)

plg wrote:

Issue fixed for the upcoming Piwigo 2.7.1, see [Subversion] r29904

Merci :)

Offline

 

#12 2014-12-27 04:15:13

Bruce VanBuren
Guest

Re: Fix for ZLib issues on Ubuntu (and other OS's)

Still fails!
Update to Piwigo 2.7.2

Piwigo version
Piwigo 2.6.3
Check for upgrade
Environment
Operating system: Linux
PHP: 5.5.9-1ubuntu4.5 (Show info) [2014-12-26 22:12:01]
MySQL: 5.5.40-0ubuntu0.14.04.1 [2014-12-26 22:12:01]
Graphics Library: ImageMagick 6.7.7-10

 
  •  » Requests
  •  » Fix for ZLib issues on Ubuntu (and other OS's)

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact