Questions tagged [php-zip-archive]
70 questions
1
vote
0 answers
Return ZIP archive in CakePHP 3.0
In CakePHP controller I have the logic to generate a ZIP which is as follows and works perfectly fine, I can find the ZIP archive on the server:
function getAttachmentsInZip( $meetingId = null ){
$this->autoRender = false;
…

WpDoe
- 476
- 1
- 7
- 22
1
vote
1 answer
PHP how to remove author metadata from docx
In PHP I've to remove the author metadata from a DOCX file. First of all, I've unzip the document and after I've edit the author metadata setting it empty using an XML reader library.
$file = 'document.docx';
$filename = 'path/'.$file;
// Unzip the…

apanzett
- 11
- 3
0
votes
2 answers
Laravel PHP create empty new zip archive
I don't understand why every time I run the following script, the zip file will contain all the previous files.
I want to start with an empty archive every time I run the script. How can I do that?
I tried adding an empty folder, but that does not…

Paul Godard
- 1,055
- 1
- 14
- 30
0
votes
0 answers
How can I enable Zip Archive on VPS CentOS 7 CyberPanel?
Some context I found this article: https://community.cyberpanel.net/t/tutorial-how-to-install-any-php-modules-using-pear-package-manager/37785
I ran the commands in my terminal. Once I got to this step:
./lsphp go-pear.phar
I got this on the…

Petar
- 1
- 3
0
votes
1 answer
Class "ZipArchive" not found in Laravel
Using maatwebsite/excel package to import excel files to the app. CSV imports work properly but when I try importing XLSX(Excel) files, I get this error "Class "ZipArchive" not found".
I also checked the php modules, I have zip module…
0
votes
0 answers
Recursively Zip Multiple Folders in PHP
Following code is working fine, but only zipping one sub folder. My folder structure is like this.
MasterFolder
--example-folder
----TestFolder1
----TestFolder2
----TestFolder3
--example-file1.txt
--example-file2.txt
I need to zip the…

SammaDev
- 11
- 4
0
votes
0 answers
zip->open not working. Returning 5 (read error)
I am creating a WordPress plugin. I need to open a word document which is already stored on the server.
I have SQL bringing back the location and storing it as $file_loc http://localhost/pjmorris/wp-content/uploads/writingreview/admin/27-1.docx
$zip…

oogie
- 1
0
votes
0 answers
Php PhpZip error Unexpected end of archive
Am trying to secure files with password before downloading it, but it showing error.
Am using PhpZip
Password Secure Archive
$zipFile = new \PhpZip\ZipFile();
$zipFile->addFile(__DIR__ . "/../files/oneTextFile.txt");
// Or $zipFile->addFile(__DIR__…

Peter
- 1,860
- 2
- 18
- 47
0
votes
0 answers
how to store laravel excel in a zip file
I have a class that exports a excel file as a scheduled job:
class exportExcelBasedOnID {
public function __construct(ScheduleJob $scheduleJob) {
$scheduleJob->processed_at = Carbon::now();
$scheduleJob->processing = true;
…

apkr x
- 11
- 3
0
votes
0 answers
PHP ZipArchive is crashing after zipping a lot of files
I've created a simple programe that put photos into ZipArchive. All is working till I try to compress more than a couple photos (about 60). And after than I have something like that on a screen:
https://i.stack.imgur.com/DtgHG.png
I've changed…

Mateusz Krysiak
- 1
- 2
0
votes
1 answer
PHP8 ZipArchive EM constant TRAD_PKWARE not working
i used ZipArchive::EM_TRAD_PKWARE, with password, but zip file is not encrypted. I think that pkware not working. Have solutions ?
Thx
$zip->setEncryptionName('test.txt', ZipArchive::EM_TRAD_PKWARE, 'PASSWORD');

Lukáš Mesároš
- 1
- 1
0
votes
0 answers
Zip file encrypted and downloaded with ZipArchive not opening with the given password
I have used below code to download zip using ZipArchive by generating a pdf file from string. Random password is generated which is provided to use to open it.
$zip = new ZipArchive();
$file = sprintf('%s/%s',…

Mihir Patel
- 230
- 4
- 22
0
votes
0 answers
Installing ZipArchive on PHP7.4?
I'm running PHP7.4 on CentOS7 and am having trouble getting the zip module to show up when I run php -m
I tried installing php-zip and php-pecl-zip through yum, which gives me the following result:
Resolving Dependencies
--> Running transaction…

halsi
- 19
- 2
0
votes
2 answers
Why is my code not creating a zip folder and adding files/logo into it?
I have solve the previous problem and now it create a zip file and add all the files from a specific folder, but the zip file is not where I want it to be, the zip file is just in the public folder, how do I make it so that the zip file is created…

nung khual
- 1
- 3
0
votes
1 answer
Improving PHP ZipArchive Perfomance
I am trying to pack around 50 files from a folder to zip file using PHP ZipArchive.
Actually, only at most five files are ever changing. Others remain same static files.
Should I zip the folder for every request or just replace those five…

Yesudass Moses
- 1,841
- 3
- 27
- 63