The php docs says gzuncompress has been around since php 4.0.1
http://www.php.net/gzuncompress

but our servers (php 4.3.0) at work do not have this function. I tried bringing in code which worked at home but I got 'undefined function' at work.
function_exists('gzuncompress')
returns false.

I did a bit of checking and found that zlib is required... so I suppose our work servers don't have this installed. If I'm right, how do I add zlib to a PHP installation?

What are the chances of this function being available on typical PHP installations? I want to use this function in an Open Source project. I initially thought that if the manual said >4.0.1, then anyone with a higher version of php than that would have the function.

    It's not a default function set. You have to compile it in. If you're running a linux server, it's likely that zlib is already installed. We need some specifics about your setup though...

      We have a mix of redhat 7.3, 8 and fedora, though I didn't set them up. I use OSX myself.

      I just found the --with-zlib[=DIR] configuartion switch. So if I set that to the zlib location, all the php zlib functions will work?

      So how do I find out if zlib is installed? If I turn on the --with-zlib switch, will it just work, or do I need to set DIR to a specific file (if so, which file?)

        Okay, on those red hat/fedora boxes, you can do an rpm query.

        bash-2.05a$ [b]rpm -qa|grep zlib[/b]
        zlib-1.1.4-8.7x
        zlib-devel-1.1.4-8.7x

          Cool - thanks. I have version 1.1.3-24,
          now where is it that I stick the '--with-zlib' config switch?
          The guy at work who would know this is away.

            You have to recompile php with that in there. Run phpinfo to get your current compile options, then tack that on the end of the ./configure command. Then make, make install, and you're done.

              Thanks again, I will do this.

                Write a Reply...