【发布时间】:2020-08-18 08:36:18
【问题描述】:
我正在将请求验证为图像,但崩溃说:
“无法猜测 MIME 类型,因为没有可用的猜测器(你有 启用 php_fileinfo 扩展?)”。
在php.ini 中,我没有extension=php_fileinfo,但我确实有一个extension=fileinfo 未注释的行(我看到Lumen 放置了这个和其他没有'php_' 的依赖项)。我也尝试添加extension=php_fileinfo,但是当我从 XAMPP 重新启动 Apache 时,它会崩溃,因为它没有找到该依赖项。我该怎么办?
代码:
function updateProfilePicture(Request $request) {
$this->validate($request, [
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048'
]);
//...
fileinfo 依赖所在的 php.ini 部分:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename
;
; For example:
;
; extension=mysqli
;
; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
; extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;
; Notes for Windows environments :
;
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
extension=bz2
extension=curl
extension=fileinfo
extension=gd2
extension=gettext
也许它与关于如何设置依赖项指令的免责声明有关? (我不确定,因为extension=fileinfo 默认已经在文件中)
我使用的是 Windows 10,我在 C:\xampp\php\ext\php_fileinfo.dll 中找到了该文件
【问题讨论】:
-
您是否尝试过使用 .dll 结尾,例如“extension=php_fileinfo.dll”?
-
是的,它也不起作用
标签: php laravel apache dependencies lumen