What are my options to check for viruses on a PHP upload?(我有哪些选项可以检查 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 上传中的病毒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我有哪些选项可以检查 PHP 上传中的病毒?
基础教程推荐
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何替换eregi() 2022-01-01
