启用fileinfo扩展并重新启动Apache后,它仍然无法加载

时间:2014-06-20 18:52:48

标签: php apache xampp php-extension fileinfo

我想在PHP(5.5)中使用fileinfo扩展。 (在localhost(Windows)上,使用XAMPP)

所以我去了php.ini并注释掉了extension=php_fileinfo.dll,然后我重新启动了apache,甚至试图重启整个PC。

但是当我尝试使用它时,我仍然得到函数/类不存在...(程序/目标)

当我查看php_info()页面时,“fileinfo”仅在“模块作者”表中列出了 - 也就是说,我认为,不是enaugh - 是吗? / p>

有人知道如何解决这个问题吗?

PS:我检查了php.ini的魔法路径,并且有mime_magic.magicfile = "\xampp\php\extras\magic.mime"
但是整个xampp文件夹结构中没有这样的文件... - 这可能是为什么不加载的原因?我在哪里下载这个文件?

非常感谢!

PS2 :针对同一问题但只想上传图片的其他人的解决方案:

  $image_size_info = @getimagesize($filename); //surpress errors(@) if not image
  if( empty($image_size_info) ) $mime_type = "";
    else $mime_type = @image_type_to_mime_type( $image_size_info[2] );

  //safety for all cases:
  if( empty($mime_type) ) $mime_type = "";

  if(  strpos($mime_type, "image/") === false  ){
    //not an Image !
  } else {
    //proceed file upload
  }

0 个答案:

没有答案