0

I am trying now for some days to fix my php function. For some reason it can´t read a .zip file anymore. It happend after I changed my linux server. Before I had php 5.6 now I have php PHP Version 7.0.22-0ubuntu0.16.04.1. Is there some special php libary required?

Here is my code, but I don´t think there is something wrong cause it worked before:

    /*
    Get donwloaded version
*/
$downloadVersion        =   "Unknown";

$fileData = function() {
    $file = fopen('zip://interface.zip#php/functions/functions.php', 'r');
    if (!$file)
    {
        die('Can not read zip file! Please be sure, that we have in this folder the interface.zip file!');
    };

    while (($line = fgets($file)) !== false)
    {
        yield $line;
    };
};

foreach ($fileData() as $line) {
    if(strpos($line, "define(\"INTERFACE_VERSION\"") !== false)
    {
        $lineparts          =   explode("\"", $line);
        $downloadVersion    =   $lineparts[3];
    };
};

BTW the interface.zip file exists I´ve also checked it with the php file_exists function. Also the path and file functions.php exits. Has anybody an idea? If I try to open the page it says:

Can not read zip file! Please be sure, that we have in this folder the interface.zip file!

Lukas Gund
  • 639
  • 1
  • 9
  • 27

1 Answers1

0

I´ve found out after I tried

check this out stackoverflow.com/a/9817562/1894905 – 6339

that the whole zip archive could be not loaded. After I run

apt-get install php7.0-zip

into the shell the needed libary´s are installed and it worked.

Thanks for the info!

Lukas Gund
  • 639
  • 1
  • 9
  • 27