Failed to load magic database at '' Laravel 4

*爱你&永不变心* 提交于 2019-12-25 03:25:07

问题


$rules = array('title' => 'required', 'thumbnail' => 'image|size:500');
$inputs = array('title' => $this->title, 'thumbnail' => $this->thumbnail,);
$validator = Validator::make($inputs, $rules);

if ($validator->fails()) {

}

If I remove the 'thumbnail' it's working, but if it's there, it crashes when it does the $validator->fails()


回答1:


The Failed to load magic database message is a PHP error message, not related to Laravel.

There's a problem with your libmagic installation, or it is not installed at all.

http://php.net/manual/en/ref.fileinfo.php

PHP Warning:  finfo::finfo(): Failed to load magic database at '/etc/magic' 
PHP Warning:  finfo::file(): The invalid fileinfo object 

These errors can be rectified by copying your magic database (depending on your distro, this file can be anywhere, on debian it's in /usr/share/file/magic) to /etc/magic.mime 

libmagic automatically appends the .mime to the end of the filename, so PHP incorrectly reports the path it was looking for. 

The same applies for: 
PHP Warning:  finfo::finfo(): Failed to load magic database at '/etc/magic.mime' 

Unfortunately users will have to call the magic file /etc/magic.mime.mime in this case.


来源:https://stackoverflow.com/questions/17045340/failed-to-load-magic-database-at-laravel-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!