简体   繁体   中英

php extract zip file in safe_mode on

how can i do extract zip file for script setup in safe_mode on

i'm trying this

   require_once('pclzip.lib.php');
   $archive = new PclZip('archive.zip');
   if (($v_result_list = $archive->extract()) == 0) {
     die("Error : ".$archive->errorInfo(true));
   }
   echo "<pre>";
   var_dump($v_result_list);
   echo "</pre>";

but i get OWNER error on the extracted dir

How do i fix this problem, or i think re connect to this ftp again and upload and extract file to this ftp

   $local_file = './arcive.zip';
   $ftp_path = '/extract';
   $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");
   ftp_login($conn_id, $usr, $pwd) or die("Cannot login");
   $upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII);

How do you think i can do?

when a file is unzipped it preserves the owner and permissions information. In your case it's likely that the permissions do not allow world access. if the owner of the file is different from the account that PHP runs under, you cannot chown the file or change permissions. Unless PHP is run as root (and who does that?). in safe mode you can't even do that as root. Ask the person who archives the file to make it "read & write" for everybody.

As for the second part of the question, you cannot extract something on another server over ftp protocol. you'd have to ssh into the server.
http://phpseclib.sourceforge.net might be of help in that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM