V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iugo
V2EX  ›  PHP

为什么要关闭 fileinfo? fileinfo 有什么隐患吗?

  •  
  •   iugo · 2015-05-24 10:10:06 +08:00 · 7973 次点击
    这是一个创建于 3252 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在某脚本编译 PHP 的时候, 存在这样一句

    --disable-fileinfo

    可是我正在使用的小工具需要这个东西.

    想问一下为什么这个脚本在编译的时候加上这样一个参数, fileinfo 是不被推荐的吗?

    http://php.net/manual/zh/fileinfo.installation.php 中描述, fileinfo 在 5.3 以后就被默认安装的, 应该是 PHP 官方建议的东西.
    5 条回复    2015-05-24 17:30:52 +08:00
    xbonline
        1
    xbonline  
       2015-05-24 10:27:55 +08:00 via Android   ❤️ 1
    很久以前,在我的小内存VPS上编译PHP会out of memory,加上disable-fileinfo后就可以顺利编译了
    zts1993
        2
    zts1993  
       2015-05-24 10:59:54 +08:00
    @xbonline 正解
    dryyun
        3
    dryyun  
       2015-05-24 12:03:24 +08:00
    记得1G以下的内存,编译会出现问题,就需要--disable-fileinfo
    liuhaotian
        4
    liuhaotian  
       2015-05-24 12:40:07 +08:00
    The functions in this module try to guess the content type and encoding of a file by looking for certain magic byte sequences at specific positions within the file. While this is not a bullet proof approach the heuristics used do a very good job.

    我的小内存 vps 昨天编译 out of memory,然后进程被 kill,disable 这个之后就可以了。
    FrankFang128
        5
    FrankFang128  
       2015-05-24 17:30:52 +08:00
    感觉就不应该被开启的样子。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3685 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 04:43 · PVG 12:43 · LAX 21:43 · JFK 00:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.