php_zip 在 php 5.3.5 中不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6846553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:27:04  来源:igfitidea点击:

php_zip does not exist in php 5.3.5

phpzipphpexcel

提问by Steven

I'm in the process of using PHPExcel. One of the requirements is that I need to enable php_zip.

我正在使用 PHPExcel。要求之一是我需要启用 php_zip。

(...) if you need PHPExcel to handle .xlsx or .ods files you will need the zip extension...

(...) 如果您需要 PHPExcel 来处理 .xlsx 或 .ods 文件,您将需要 zip 扩展名...

I'm using PHP v5.3.5. and in my php.inifile, I have the following lines:

我正在使用 PHP v5.3.5。在我的php.ini文件中,我有以下几行:

;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll

If I remove the ;in the last line, and restart Wampserver, I get the following error message:

如果我删除;最后一行中的 并重新启动 Wampserver,我会收到以下错误消息:

PHP Startup: Unable to load dynamic library 'I:/wamp/.../ext/php_zip.dll' - The specified module could not be found.

PHP 启动:无法加载动态库 'I:/wamp/.../ext/php_zip.dll' - 找不到指定的模块。

Reading the web, many says that as of PHP 5.3.0, php_zip is built-in.

阅读网络,许多人说从 PHP 5.3.0 开始,php_zip 是内置的。

If it is built then why is this line still in the configuration?
Do I get the error message because since it's built in, the file has been removed?

如果它已构建,那么为什么这条线仍在配置中?
我是否收到错误消息,因为它是内置的,文件已被删除?

PS. Sorry if this is in the wrong forum, but not sure where else to put it.

附注。抱歉,如果这是在错误的论坛中,但不确定该放在哪里。

回答by marc

In fact, Zip is included by default. It is a bugthat the line is still included.

事实上,默认情况下包含 Zip。仍然包含该行是一个错误

回答by Ben

marc answer is right. I wanted to add a comment that using

马克的回答是对的。我想添加一条评论,使用

extension_loaded('zip');

returns false as it is no longer an extension, you could use

返回 false 因为它不再是扩展名,您可以使用

class_exists('ZipArchive');

to check for it now.

现在检查它。

回答by Jason Kaczmarsky

I've had a similar problem with a different library. WAMP doesn't include many libraries by default for some reason.

我在不同的图书馆遇到了类似的问题。由于某种原因,WAMP 默认不包含很多库。

What I did was download the full PHP installation as a zip from php.netand the required dll was found in the extensions folder just as it is in WAMP. I just copied it from the zip to the WAMP extension folder and it worked fine.

我所做的是从php.net以 zip格式下载完整的 PHP 安装,并且在扩展文件夹中找到了所需的 dll,就像在 WAMP 中一样。我只是将它从 zip 复制到 WAMP 扩展文件夹,它运行良好。