zipArchive open error in PHP

后端 未结 2 1665
隐瞒了意图╮
隐瞒了意图╮ 2020-12-22 02:56

Cannot create zip archive in PHP, always returns ZIPARCHIVE::ER_MULTIDISK

$fileName=$_SERVER[\'DOCUMENT_ROOT\'].\'/temp/temp.zip\';
$zip = n         


        
相关标签:
2条回答
  • 2020-12-22 03:29

    I think that your issue has to be something with the php version, sounds like it's this: (from php.net comments):

    Some older PHP versions used to return false if zip_open failed, and newer versions return the number of error (as integer), so instead of this:

    $zip = zip_open($zip_file);
    if ($zip) {
      // consider zip file opened successfully
    }
    

    use this:

    $zip = zip_open($zip_file);
    if (is_resource($zip)) {
      // consider zip file opened successfully
    }
    

    Sounds like you are getting the first non numeric index from the array, maybe '1' as 'true' and that's why it's displaying the element '1' on your errors array

    0 讨论(0)
  • 2020-12-22 03:45

    First, check if you can create files with php on server side. There may be an identity problem. php may operate on i.e: apache id and your id is yourFtpId..

    Then check if zip library is supported with php on the server, phpinfo can show that.

    Then check if your server configuration allows zip commands from php.

    When these diagnostics are over, if you find a problem with these, you should address the server admin to solve them.

    0 讨论(0)
提交回复
热议问题