致命错误:找不到类"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).