← Back to team overview

ius-community team mailing list archive

file info module doesn't work

 

Hello all, can't get to work that module on CentOS-5.9 x64

# php -v
PHP 5.3.24 (cli) (built: Apr 12 2013 10:08:07)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

I have tried to execute simple php script

<?php
$finfo = new finfo(FILEINFO_MIME, "/usr/share/file/magic");

if (!$finfo) {
    echo "Opening fileinfo database failed";
    exit();
}

/* get mime-type for a specific file */
$filename = "/tmp/finfo.php";
echo finfo_file($finfo, $filename);

/* close connection */
finfo_close($finfo);
?>

And got the following messages
# php finfo.php
PHP Warning:  finfo::finfo(): Failed to load magic database at
'/usr/share/file/magic'. in /tmp/finfo.php on line 2
Opening fileinfo database failed

Any advise?