致命错误:找不到类"ZipArchive" [英] Fatal error: Class 'ZipArchive' not found in

查看:503
本文介绍了致命错误:找不到类"ZipArchive"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我在Linux服务器上安装了"Archive_Zip 0.1.1",但是当我尝试运行脚本来创建zip文件时,却出现了致命错误

I have a problem that I install 'Archive_Zip 0.1.1' on Linux server, but when I try to run the script to create the zip file it gives the fatal error

致命错误:在...中找不到类ZipArchive

我在其中放置代码

$zip = new ZipArchive;
var_dump($zip);
$res = $zip->open($filename, ZipArchive::OVERWRITE);
if ($res !== TRUE) {
    echo 'Error: Unable to create zip file';
    exit;
}
if (is_file($src)) {
    $zip->addFile($src);
} else {
    // echo "<br>" . dirname(__FILE__) . $src;//'/install1';
    if (!is_dir($src)) {
         $zip->close();
         @unlink($filename);
         echo 'Error: File not found';
         exit;
    }
    recurse_zip($src, $zip, $path_length);
}
$zip->close();
echo "<br>file name ".$filename;

,但找不到类文件.

请告诉我解决方案.我该怎么办才能解决问题? 我也将php.ini文件放在脚本所在的文件夹中,但是它不起作用.

Please tell me the solution. What should I do to resolve the problem? I also put php.ini file to the folder where script is, but it does not work.

推荐答案

对于要提供ZipArchive,PHP需要具有 zip扩展名已安装.

有关安装说明(Linux和Windows),请参见本页.

See this page for installation instructions (both Linux and Windows).

这篇关于致命错误:找不到类"ZipArchive"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆