SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2008
    Location
    Asheville, NC
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    compressing files and directories w/o zip?

    hi, all.

    I need to keep a directory of files (also has subdirectories with more files) synchronized on a few sites. all files come from a central location.

    I thought I'd use zip to download from the main site and then unzip in the sites to keep them up to date.

    problem is, some PHP installations might not have zip enabled.

    is there another solution to this, like a compression library that has no dependencies? it doesn't have to compress data, just transport it from main site to other ones.

    files are images, javascript, PHP etc.
    directory structure should be kept intact.

    thanks a bunch!

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can make a zip program 100% with just php. But by wanting to do this from php, are you safe to assume that php will have permission to write to the filesystem? If these aren't your hosting accounts where you can control this, don't make such an assumption.

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2008
    Location
    Asheville, NC
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi, thanks for replying.

    yeah, I can definitely write to the filesystem.

    I could do a zip program like with file_get_contents for each file and some XML to keep track of the directory structure, to put the files back together, but I was wondering if there was like a library or some open source solution...

    any idea?

    thanks!

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    Texas
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does your solution have to be PHP based? I run rsync as a cron job to do exactly what you're describing without any file compression.

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2008
    Location
    Asheville, NC
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Keeton View Post
    Does your solution have to be PHP based? I run rsync as a cron job to do exactly what you're describing without any file compression.
    yes, it's gotta be PHP, as I have no idea whether the other websites will have rsynch installed or will even be hosted on linux or win...

  6. #6
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's existing code out there which can unzip using pure php, without requiring any zip extensions be loaded. It's probably pretty slow, but its portable.

  7. #7
    SitePoint Zealot
    Join Date
    Mar 2008
    Location
    Asheville, NC
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by crmalibu View Post
    There's existing code out there which can unzip using pure php, without requiring any zip extensions be loaded. It's probably pretty slow, but its portable.
    awesome

    any idea what term I could use to google for something like that?

  8. #8
    SitePoint Zealot
    Join Date
    Mar 2008
    Location
    Asheville, NC
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •