开发者

php extract zip file in safe_mode on

开发者 https://www.devze.com 2023-03-03 06:28 出处:网络
how can i do extract zip file for script setup in safe_mode on i\'m trying this require_once(\'pclzip.lib.php\');

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

0

精彩评论

暂无评论...
验证码 换一张
取 消