Can't unzip via php

I want to have a php file that is able to unzip a .zip file and just put it in the same folder.
I have this php code:

$zip = new ZipArchive;
$zip->open('/path/to//file.zip');
$zip->extractTo('/path/to/extract/');
$zip->close();

however, this does not work at all, and as soon as the code gets to the first line it dies and stops. What is going on?

It is because there is a missing PHP extension caused by the PHP upgrade. In this case, ZIP extension was required to do so, which is one of the extension missing.

From announcement:

3 Likes

What is the PHP error you see when you try to run that code? If you don’t see any error, please try enabling display_errors on the domain:

3 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.