无法在''Laravel 4中加载魔术数据库

时间:2013-06-11 13:28:45

标签: laravel laravel-4

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

if ($validator->fails()) {

}

如果我删除'thumbnail'它的工作,但如果它在那里,它会在$validator->fails()

时崩溃

1 个答案:

答案 0 :(得分:1)

Failed to load magic database消息是PHP错误消息,与Laravel无关。

您的libmagic安装存在问题,或者根本没有安装。

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.