zlib instalation and configuring problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MZ

    #1

    zlib instalation and configuring problem

    Hello!

    I`ve tried to instal zlib library to use zip functions to pack files into
    zip archive.

    I don`t know how I have to configure zlib to make it work.

    I have built up php.ini file and I`ve put such line

    --with-zlib=/home/domena_nazwa/domains/test.com/public_html/gallery/lib/zziplib.lib

    but unfortunately it doesn`t work

    I have tried

    --with-zlib=/gallery/lib/

    and it also doesn`t set up the with-zlib line( I`ve checked in phpinfo())

    I`ve put php.ini in the folder public_html on my server

    What did I do wrong?

    What else should I do to use zip library perfectly?

    Please help me!
    Thank you in advance
    M.

  • Charles Polisher

    #2
    Re: zlib instalation and configuring problem

    MZ <marcinzmyslows ki@poczta.onet. plwrote:
    Hello!
    >
    I`ve tried to instal zlib library to use zip functions to pack files into
    zip archive.
    >
    I don`t know how I have to configure zlib to make it work.
    >
    I have built up php.ini file and I`ve put such line
    >
    --with-zlib=/home/domena_nazwa/domains/test.com/public_html/gallery/lib/zziplib.lib
    >
    but unfortunately it doesn`t work
    >
    I have tried
    >
    --with-zlib=/gallery/lib/
    >
    and it also doesn`t set up the with-zlib line( I`ve checked in phpinfo())
    >
    I`ve put php.ini in the folder public_html on my server
    >
    What did I do wrong?
    >
    What else should I do to use zip library perfectly?
    >
    Please help me!
    Thank you in advance
    M.
    MZ,

    The --with-zlib line goes in the ./configure line when you build PHP
    from source. You can get a list of all the configuration directives with:
    ./configure --help
    You might also be interested in using --with-zlib-dir.

    Hope that helps,

    --
    Charles

    Comment

    • K.

      #3
      Re: zlib instalation and configuring problem


      U¿ytkownik "Charles Polisher" <cpolish@nonesu ch.comnapisa³ w wiadomo¶ci
      news:slrng8d4di .f9h.cpolish@ke vin.peecee3.com ...
      MZ <marcinzmyslows ki@poczta.onet. plwrote:
      >Hello!
      >>
      >I`ve tried to instal zlib library to use zip functions to pack files into
      >zip archive.
      >>
      >I don`t know how I have to configure zlib to make it work.
      >>
      >I have built up php.ini file and I`ve put such line
      >>
      >--with-zlib=/home/domena_nazwa/domains/test.com/public_html/gallery/lib/zziplib.lib
      >>
      >but unfortunately it doesn`t work
      >>
      >I have tried
      >>
      >--with-zlib=/gallery/lib/
      >>
      >and it also doesn`t set up the with-zlib line( I`ve checked in phpinfo())
      >>
      >I`ve put php.ini in the folder public_html on my server
      >>
      >What did I do wrong?
      >>
      >What else should I do to use zip library perfectly?
      >>
      >Please help me!
      >Thank you in advance
      >M.
      >
      MZ,
      >
      The --with-zlib line goes in the ./configure line when you build PHP
      from source. You can get a list of all the configuration directives with:
      ./configure --help
      You might also be interested in using --with-zlib-dir.
      >
      Hope that helps,
      >
      --
      Charles

      I have just noticed that I have ZLIB class enabled - maybe (I have checked
      it using phpinfo()):

      ZLib Support enabled
      Stream Wrapper support compress.zlib://
      Stream Filter support zlib.inflate, zlib.deflate
      Compiled Version 1.2.3
      Linked Version 1.2.3

      Directive Local Value Master Value
      zlib.output_com pression Off Off
      zlib.output_com pression_level -1 -1
      zlib.output_han dler no value no value

      So why when I do:

      $zip = new ZipArchive();
      $filename = "photos/zip/".str_repla ce(" ","",$_GET["gallery_na me"]).".zip";
      echo $filename;
      if ($zip->open($filename , ZIPARCHIVE::CRE ATE)!==TRUE)
      {
      exit("cannot open <$filename>\n") ;
      }
      $thisdir="/photos/";
      $zip->addFile($thisd ir."truck1.jpg" ,"truck1.jpg ");
      echo "numfiles: " . $zip->numFiles . "\n";
      echo "status:" . $zip->status . "\n";
      $zip->close();

      I still get the error like this class is still invisible for php:

      Fatal error: Class 'ZipArchive' not found in
      /home/test/domains/test.pl/public_html/photos/index.php on line 88

      I have got such line in phpinfo():

      --with-zlib-dir=/usr/local/lib

      Thank you in advance for help
      M.


      Comment

      • K.

        #4
        Re: zlib instalation and configuring problem

        Now it works.
        I have thought about zlib, but I use zip functions example.

        Below zlib functions works:

        function compress( $srcFileName, $dstFileName )
        {
        // getting file content
        $fp = fopen( $srcFileName, "r" );
        $data = fread ( $fp, filesize( $srcFileName ) );
        fclose( $fp );

        // writing compressed file
        $zp = gzopen( $dstFileName, "w9" );
        gzwrite( $zp, $data );
        gzclose( $zp );
        }

        function uncompress( $srcFileName, $dstFileName, $fileSize )
        {
        // getting content of the compressed file
        $zp = gzopen( $srcFileName, "r" );
        $data = fread ( $zp, $fileSize );
        gzclose( $zp );

        // writing uncompressed file
        $fp = fopen( $dstFileName, "w" );
        fwrite( $fp, $data );
        fclose( $fp );
        }

        compress( "tmp/truck2.jpg", "tmp/truck2.jpg.gz" );

        but below functions doesn`t work, because it is zip (not zlib):

        $zip = new ZipArchive();
        $filename = "./test112.zip";

        if ($zip->open($filename , ZIPARCHIVE::CRE ATE)!==TRUE) {
        exit("cannot open <$filename>\n") ;
        }

        $zip->addFromString( "testfilephp.tx t" . time(), "#1 This is a test string
        added as testfilephp.txt .\n");
        $zip->addFromString( "testfilephp2.t xt" . time(), "#2 This is a test string
        added as testfilephp2.tx t.\n");
        $zip->addFile($thisd ir . "/too.php","/testfromfile.ph p");
        echo "numfiles: " . $zip->numFiles . "\n";
        echo "status:" . $zip->status . "\n";
        $zip->close();


        Thank you for interesting my post
        M.


        Comment

        • Charles Polisher

          #5
          Re: zlib instalation and configuring problem

          <halinacierniak @poczta.onet.pl wrote:
          Now it works.
          I have thought about zlib, but I use zip functions example.
          >
          Below zlib functions works:
          <snip>
          but below functions doesn`t work, because it is zip (not zlib):
          >
          $zip = new ZipArchive();
          $filename = "./test112.zip";
          >
          if ($zip->open($filename , ZIPARCHIVE::CRE ATE)!==TRUE) {
          exit("cannot open <$filename>\n") ;
          }
          >
          $zip->addFromString( "testfilephp.tx t" . time(), "#1 This is a test string
          added as testfilephp.txt .\n");
          $zip->addFromString( "testfilephp2.t xt" . time(), "#2 This is a test string
          added as testfilephp2.tx t.\n");
          $zip->addFile($thisd ir . "/too.php","/testfromfile.ph p");
          echo "numfiles: " . $zip->numFiles . "\n";
          echo "status:" . $zip->status . "\n";
          $zip->close();
          >
          >
          Thank you for interesting my post
          M.
          See: http://us.php.net/manual/en/zip.installation.php
          or http://us.php.net/manual/pl/zip.installation.php

          Best regards,
          --
          Charles

          Comment

          Working...