Reputation: 1655
I get the following error in a program called "Collective Access", but I am not sure where to go to from here given that I haven't ever had an experience with this type of issue before:
PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in /var/www/html/providence/app/lib/core/Parsers/PHPExcel/PHPExcel/Reader/Excel2007.php:94
Stack trace:
#0 /var/www/html/providence/app/lib/core/Parsers/PHPExcel/PHPExcel/IOFactory.php(268): PHPExcel_Reader_Excel2007->canRead('project/mapping...')
#1 /var/www/html/providence/app/lib/core/Parsers/PHPExcel/PHPExcel/IOFactory.php(191): PHPExcel_IOFactory::createReaderForFile('project/mapping...')
#2 /var/www/html/providence/app/models/ca_data_importers.php(768): PHPExcel_IOFactory::load('project/mapping...')
#3 /var/www/html/providence/app/lib/ca/Utils/CLIUtils.php(1147): ca_data_importers::loadImporterFromFile('project/mapping...', Array, Array)
#4 /var/www/html/providence/support/bin/caUtils(166): CLIUtils::load_import_mapping(Object(Zend_Console_Getopt))
#5 {main}
thrown in /var/www/html/providence/app/lib/core/Parsers/PHPExcel/PHPExcel/Reader/Excel2007.php on line 94
PS - This is the code around line 94 of the file it is referring to:
$xl = false;
// Load file
$zip = new $zipClass;
if ($zip->open($pFilename) === true) {
// check if it is an OOXML archive
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if ($rels !== false) {
foreach ($rels->Relationship as $rel) {
switch ($rel["Type"]) {
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
if (basename($rel["Target"]) == 'workbook.xml') {
$xl = true;
}
break;
}
}
}
$zip->close();
}
return $xl;
}
I'm using 7.0.15-0ubuntu0.16.04.4 for php (or just version 7.0 on Ubuntu Server 16.04.4)
Upvotes: 2
Views: 8407
Reputation: 72226
The ZipArchive
class is provided by the Zip PHP extension that, according to its documentation needs to be enabled on the compilation of PHP (on Linux) or in php.ini
(on Windows).
There is a great chance that the extension is not available on your system. Write <?php phpinfo();
in a new file, open it in browser (through the webserver) and check if the Zip extension is compiled or enabled.
If your script is a command line tool then run the phpinfo()
file using the PHP CLI or simply run in the terminal:
$ php -m
to see the list of loaded extensions (modules) or
$ php -i
to see the complete information displayed by phpinfo()
.
Upvotes: 2