我有什么选择来检查PHP上传的病毒? [英] What are my options to check for viruses on a PHP upload?

查看:195
本文介绍了我有什么选择来检查PHP上传的病毒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待看看如何通过PHP检查上传的文件是否有病毒。什么样的选择存在,每个优点和缺点等等。 解决方案

是一款免费的反病毒软件,通常用于服务器应用程序。



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



我找到了关于如何使用clamav作为Zend Framework Validator的教程,该教程已经包含了关于如何验证上传文件。本教程还应该帮助您在另一个框架或体系结构上使用它。



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


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 is a free anti virus commonly used on server applications.

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

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.

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上传的病毒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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