Unzip/Extract zip/gzip file on Server

Discussion in 'PHP' started by Agent47, May 1, 2006.

  1. #1
    I am trying to extract a zip file on server with the help of PHP. I tried the following code but it isn't working:
    
    exec('unzip my_zip_file.zip');
    
    PHP:
    Please help :)
     
    Agent47, May 1, 2006 IP
  2. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to confirm that PHP and/or your web server has permission to run the unzip command and that the command is actually available.

    Also, from the PHP manual:

     
    clancey, May 1, 2006 IP
  3. Agent47

    Agent47 Well-Known Member

    Messages:
    775
    Likes Received:
    138
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Thanks for the reply. Will check this with my host.

    I somehow managed to extract the zip file via SSH using the code unzip my_zip_file.zip. Everything in that archive was extracted but I have another problem now. The extracted files have permissions set to 700 and I have to set the permission of each and every file manually. Is there any command that can change the permission of all files including files in sub directories to 755 via SSH command line?
    I tried chmod 755 * but it changed the permissions of the root files not all the files located in sub directories.
     
    Agent47, May 1, 2006 IP
  4. Agent47

    Agent47 Well-Known Member

    Messages:
    775
    Likes Received:
    138
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Never mind; I got it working. To CHMOD all files and folders in current working directory and each subsequent sub-directory and file i used chmod -R 755 *
     
    Agent47, May 1, 2006 IP