I've searched all over for a solution to this and I can't find one.
I'm doing something like the following:
$data = file_get_contents('zip://../files/' . $this->_file->getHash() . '.zip#' . $stat['name']);
The specific error is:
failed to open stream: operation failed
It works on a Linux machine I use, but I'm trying to get the project running on a Windows box. I know that the path to the zip file is correct and it is readable because in the same code that the above snippet is located in, I read it using the ZipArchive class, like this:
$this->_za = new ZipArchive();
$res = $this->_za->open('../files/' . $file->getHash() . '.zip');
And that works perfectly fine.
Why can't file_get_contents read from the zip? Is there something I have to do to the files directory? I'm not very good at folders and permissions on Windows.
Edit: to be absolute sure it wasn't an issue with my code, I set up a very simple test script, with a zip file in the exact same directory:
<?php
$za = new ZipArchive();
$res = $za->open('myZip.zip');
for($i=0; $i<$za->numFiles; $i++)
{
$stat = $za->statIndex($i);
$data = file_get_contents('zip://myZip.zip#' . $stat['name']);
echo $stat['name'];
echo $data;
}
This outputs the name of each file in the zip (from the echo $stat['name'] part) but then produces the exact same error as before, i.e.,
failed to open stream: operation failed