简体   繁体   中英

Call to undefined function finfo_open() showing error on server only

When i am uploading this on my server then it shows me error:

Call to undefined function finfo_open()

, But on localhost it works.

$img_file= $row['CERT_IMAGE'];
$type1="../img/certImg/".$img_file;
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$type = getMIMEType($type1);
echo $type;

function getMIMEType($type1){
 $finfo = finfo_open();
 $fileinfo = finfo_file($finfo, $type1, FILEINFO_MIME_TYPE);
 finfo_close($finfo);
 return $fileinfo;
}  

 <td width="5%" align="center"><strong>:</strong></td> <?php if($type == "application/pdf") { ?> <td width="55%" align="left"><iframe src="../img/certImg/<?php echo $img_file;?>" style="width:200px; height:300px;" frameborder="0"></iframe> <br> <a class="btn btn-primary" id="btnSubmit" target="_blank" href="../img/certImg/<?php echo $img_file;?>" style="font-size:20px; ">View Pdf</a> </td> <?php } else { ?> <td width="55%" align="left"><img src="../img/certImg/<?php echo $img_file; ?>" id="myImg" width="200px" height="300px"></td> <?php } ?> </tr> 

确保已在php.ini中启用了fileinfo.so或php_fileinfo.dll

extension=fileinfo.so or extension=php_fileinfo.dll

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM