Questions tagged [php-zip-archive]

70 questions
2
votes
1 answer

PHP unzip file into directory, change unzipped folder's name

Is it possible to intercept the unzipping of a directory to change the name of the unzipped folder-to-be? I'm using the PHP ZipArchive class to do this. The unzipping is working fine, I'd just like to add a timestamp to the unzipped folder's…
Lauren F
  • 1,282
  • 4
  • 18
  • 29
1
vote
1 answer

Strange behaviour when try to extract a zip file in docker container with laravel

I'm trying to extract a zip archive in a docker container app running Laravel 9 on PHP 8.1.7, and i'm facing a weird error. So if a try this code in a controller $zip = new ZipArchive(); $result =…
cesare
  • 2,098
  • 19
  • 29
1
vote
0 answers

PHP ZipArchive | creating unsupported file & not downloading on Cpanel | working on local

hi my goal is to create zip file and download it, working okay on local server but giving problem on Cpanel when i hit download button $fileEntry = FileEntry::with('childEntriesRecursive')->where('shared_id',…
shazim ali
  • 360
  • 4
  • 18
1
vote
0 answers

php5.6-zip not available?

I am currently using php 5.6 for one of my very old project, it is on ubuntu 16.04. I needed to install php-zip extension on it. I tried apt-get install php5.6-zip, did not work. Showed there is no package with that name. So, I searched and it…
Abir Imtiaz
  • 33
  • 1
  • 10
1
vote
1 answer

php_zip.dll on start can't be found on start

I'm trying to install php_zip for a laravel project. I'm using Windows. I then put this php_zip.dll inside my php/ext folder. I then edited my php.ini file to add this line : extension=zip to add zip among the existing extensions. Still PHP tells…
1
vote
0 answers

I am tryign to create a zip of my wp folder but getting error

What I am trying to do is creating a zip file public function createFilesBackup() { $dir = home_path(); $sitePath = realpath($dir); $zip = new ZipArchive(); $files = new RecursiveIteratorIterator( …
Abdul Basit
  • 161
  • 1
  • 1
  • 11
1
vote
1 answer

PHP ZipArchive Removing First Character of Filenames

The code below successfully creates a zip file of a specified directory and all sub-directories. The problem I am having is that the end result removes the first character from each filename and folder-name within the root directory; this same…
1
vote
0 answers

I can't get PHP zip extension to work on WAMP

I am using WAMP with PHP 7.2.4. I need to use PHP's ZipArchive, for which I need the zip.so (php_zip.dll) extension. I've read it is somehow included in PHP's core since 5.6.x (I believe), so I tried to simply…
Kristián Filo
  • 827
  • 2
  • 8
  • 25
1
vote
3 answers

Unable to load dynamic library 'zip.so' on Centos 7.6.1810 using remi-php72 repo

I am having problems getting October CMS to update: Update failed "Class 'ZipArchive' not found" on line 51 of /var/www/html/jdd/htdocs/vendor/october/rain/src/Filesystem/Zip.php And if I do php -m, i get the following warning: PHP Warning: PHP…
Plastopian
  • 13
  • 1
  • 1
  • 5
1
vote
1 answer

unable to create a valid zip file in php using zip archive?

I am using ziparchive to create a zip for some files and then need to download the file using the following code. if(count($valid_files > 0)){ $zip = new ZipArchive(); $zip_name = "pixels.zip"; if($zip->open($zip_name,…
OshoParth
  • 1,492
  • 2
  • 20
  • 44
1
vote
1 answer

PHP ZipArchive dont support UTF8 files for open

PHP ZipArchive dont support UTF8 files for open my problem is OPEN files with UTF8 name. ZipArchive dont open files with UTF8 character. i dont add new file i need only open file. php: 5.6 and Use Yii2. code: $path = "files/تست تست.zip"; …
user3770797
  • 374
  • 5
  • 24
1
vote
0 answers

PHP ZipArchive file iteration ignores directories

I'm using the ZipArchive class in PHP for the first time, and I'm having a bit of trouble. All I'm trying to do is iterate through the files in the ZIP archive, and it all works, except it doesn't seem there's any way to get subdirectory names…
IceMetalPunk
  • 5,476
  • 3
  • 19
  • 26
1
vote
1 answer

Extract ZIP file, including hidden files

I'm using ZipArchive and I want to extract ZIP file. I can see a comment in the docs for ZipArchive::extractTo: Note, in Linux (possibly other *nix platforms too) there is no way to extract hidden files ( aka filename starting with a '.') from a…
Jakub Krol
  • 350
  • 5
  • 16
1
vote
1 answer

PHP ZipArchive class does not create archive

I am trying to create an archive of selected files using following code $zip_in = new \ZipArchive; if ($zip_in->open('input.zip') === TRUE) { $files = array(); for ($loop = 0; $loop < $zip_in->numFiles; $loop++) { $files[] =…
i01000001
  • 119
  • 1
  • 2
  • 9
1
vote
2 answers

PHP ZipArchive addFile stopped working

I have the following code running for quite some time now: $thisdir = "$_SERVER[DOCUMENT_ROOT]/webroot/uploads/user_uploaded_files/"; if( !empty( $files ) ){ $destination = 'uploads/zip_files/meeting_' . $meetingId .'.zip'; $zip =…
Domas
  • 1,133
  • 4
  • 18
  • 46