【问题标题】:Failed to load magic database at '' Laravel 4无法在“Laravel 4”加载魔术数据库
【发布时间】:2013-06-07 09:00:42
【问题描述】:
$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() 时崩溃

【问题讨论】:

  • 它“崩溃”了?你能说得更具体点吗?
  • finfo::finfo() [finfo.finfo]:无法在 '' 加载魔法数据库。这就是我得到的。

标签: laravel laravel-4


【解决方案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.

【讨论】:

  • finfo::finfo() [finfo.finfo]:无法在 '' 加载魔法数据库。这就是我得到的。我也尝试将魔术文件复制到 etc/ 但无济于事
  • 您使用的是什么服务器发行版和版本?
猜你喜欢
  • 2012-08-08
  • 2015-06-02
  • 2014-09-19
  • 1970-01-01
  • 2014-07-18
  • 1970-01-01
  • 2022-11-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多