简体   繁体   English

php在safe_mode上提取zip文件

[英]php extract zip file in safe_mode on

how can i do extract zip file for script setup in safe_mode on 我如何提取zip文件以在safe_mode上进行脚本设置

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 但是我在提取的目录上遇到了OWNER错误

How do i fix this problem, or i think re connect to this ftp again and upload and extract file to this ftp 如何解决此问题,或者我认为重新连接到该ftp并将文件上传并提取到该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. 如果文件的所有者与运行PHP的帐户不同,则您不能对文件进行chown或更改权限。 Unless PHP is run as root (and who does that?). 除非PHP以root身份运行(谁这样做?)。 in safe mode you can't even do that as root. 在安全模式下,您甚至无法以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. 至于问题的第二部分,您不能通过ftp协议在另一台服务器上提取某些内容。 you'd have to ssh into the server. 您将不得不SSH进入服务器。
http://phpseclib.sourceforge.net might be of help in that http://phpseclib.sourceforge.net可能对此有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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