问题描述
我想看看如何通过 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 上传中的病毒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)