1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need help with PclTar.lib

Discussion in 'PHP' started by thuankkk, Jan 2, 2009.

  1. #1
    Hi,

    I encountered a problem with zipping by PclTar.
    I downloaded PclTar from its website, edit something to make it work.

    Now it make perfect tar and tgz file on my PC (Windows XP).

    But when upload to my web server, an problem occured:

    When zipping (tar or tgz), it create a big big big file. For example: a directory about 174 KB, when zip with PclZip about 29KB, but with PclTar (mode tgz), it take 902 KB!!!

    Plz help me.

    Here's the PclTar set: http://www.bossftp.com/boss/file/file.zip
    And the PHP code I used:
    
    <?php
    include('file/pcltar.php');
    PclTarCreate('file.tgz', 'file', 'tgz');
    ?>
    
    PHP:
    at http://www.bossftp.com/boss/test.php (deleted)

    Thank you.
     
    thuankkk, Jan 2, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    You can use the server:
    
    exec("tar czf file.tgz file"):
    
    PHP:
     
    Kaizoku, Jan 2, 2009 IP
  3. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #3
    Thanks Kaizoku,

    Your code work!, but I need a php code that don't use exec, which most web server disable.

    I tried downloading my tgz file, and open it with WinRAR. It show me many many file with the same name (duplicate file), eg. about 30 file named file.gif in one dir :(

    I don't know what the problem is.
    Plz help me.
     
    thuankkk, Jan 3, 2009 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    I don't trust shareware like winrar, try using open source like 7zip, it supports all of winrar supports and many more like .7z, which is more superior.

    As for php version, if your host has zlib compiled in php, use http://www.phpclasses.org/browse/package/529.html
     
    Kaizoku, Jan 3, 2009 IP
    thuankkk likes this.
  5. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Let's not get ahead of ourselves when regarding 7zip. It's nice, but it can't pack .rar files.

    WinRar is commercial - granted, but written by the original developer of the .rar format, so it does exactly what you want... Just a shame he won't make the packing method open-source. (currently proprietary.)

    Dan
     
    Danltn, Jan 3, 2009 IP
  6. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #6
    Why would you want to pack .rar files, when .7z compresses more.
     
    Kaizoku, Jan 3, 2009 IP
  7. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #7
    Thanks Kaizoku,

    I've download tar.class.php and use it. In fact, it doesn't have func to add a directory recursively, and I made one for it :)

    Now i can create tar and tgz file, thanks alot; but I can't extract them :( I tried tar.class.php, archive.php and EasyArchive.class.php (download from phpclasses.org), but none of them works. Can you help me?
    (tgz and tar file created by tar.class.php can be extracted with WinRAR.)

    Thank you very much!
     
    thuankkk, Jan 3, 2009 IP
  8. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #8
    Not sure about extracting.. maybe use cpanel filemanager?
     
    Kaizoku, Jan 3, 2009 IP
  9. sikka2010

    sikka2010 Well-Known Member

    Messages:
    1,578
    Likes Received:
    143
    Best Answers:
    0
    Trophy Points:
    175
    #9
    never use 7zip manager, it is damn slow
     
    sikka2010, Jan 4, 2009 IP
  10. sikka2010

    sikka2010 Well-Known Member

    Messages:
    1,578
    Likes Received:
    143
    Best Answers:
    0
    Trophy Points:
    175
    #10
    WINRAR is the best compression tool available today :p
     
    sikka2010, Jan 4, 2009 IP
  11. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #11
    Thank Kaizoku,

    After edit some code of EasyArchive, I can create and extract Tar file :)

    Thank you very much.
    @others: I'm saying about tarring a file with PHP ;)
     
    thuankkk, Jan 4, 2009 IP