我有哪些选项可以检查 PHP 上传中的病毒?

What are my options to check for viruses on a PHP upload?(我有哪些选项可以检查 PHP 上传中的病毒?)
本文介绍了我有哪些选项可以检查 PHP 上传中的病毒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我想看看如何通过 PHP 检查上传的文件是否带有病毒.存在哪些选项,每种选项的优缺点等.

I am looking to see how I can go about checking if an uploaded file has a virus or not via PHP. What options exist, pros and cons of each, etc.

推荐答案

ClamAV 是服务器上常用的免费杀毒软件应用程序.

ClamAV is a free anti virus commonly used on server applications.

php-clamav 是一个将 ClamAV 绑定到 PHP 的扩展.您可以查看他们的文档.

php-clamav is an extension for binding ClamAV to PHP. You can check their documentation.

我找到了一个 关于如何使用 clamav 作为 Zend 框架验证器的教程,其中已经包含有关如何验证上传文件的说明.本教程还应该帮助您在其他框架或架构上使用它.

I've found a tutorial on how to use clamav as a Zend Framework Validator which already includes instructions on how to verify upload files. The tutorial should also help you on using it on another frameworks or architectures.

您还可以使用 clamscan 通过命令行界面调用 clamav.这需要安装 clamav 但不需要安装 PHP 扩展.在 PHP 端,您可以 shell_exec('clamscan myuploadedfile.zip'); 然后解析输出.以 OK 结尾的行是安全文件,以 FOUND 结尾的行是恶意文件.

You can also call clamav by its command line interface with clamscan. This requires clamav to be installed but not the PHP extension. In the PHP side, you can shell_exec('clamscan myuploadedfile.zip'); then parse the output. Lines ending with OK are safe files, lines ending with FOUND are malicious files.

这篇关于我有哪些选项可以检查 PHP 上传中的病毒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)