| 1 |
MimeDetect strives to provide consistent and accurate server side MIME type
|
| 2 |
detection. It supports the PHP FileInfo Extension, the UNIX 'file' command,
|
| 3 |
then tries to use the MIME type supplied with the file object. If everything
|
| 4 |
fails it will select a MIME type based on file extension.
|
| 5 |
|
| 6 |
MimeDetect is Distributed with a magic database to make FileInfo based MIME
|
| 7 |
detection more consistent across servers.
|
| 8 |
|
| 9 |
Troubleshooting
|
| 10 |
===============
|
| 11 |
In some cases this database file, 'magic', does not work with your server. You
|
| 12 |
have to use the 'magic' file of your distribution, which usually comes with
|
| 13 |
File 4.x on your server.
|
| 14 |
|
| 15 |
In your settings.php, you add a new variable that tells Mimedetect the
|
| 16 |
absolute path of the magic file to use:
|
| 17 |
$conf = array(
|
| 18 |
'mimedetect_magic' => 'usr/share/file/magic',
|
| 19 |
);
|
| 20 |
Replace 'usr/share/file' by the magic file path if it's different on your server.
|
| 21 |
|
| 22 |
Note: if you're still having problems just creating a new PHP script outside of
|
| 23 |
Drupal to test that you can load the database:
|
| 24 |
<?php
|
| 25 |
$magic_file = '/usr/share/file/magic';
|
| 26 |
$finfo = finfo_open(FILEINFO_MIME, $magic_file);
|
| 27 |
if (!$finfo) {
|
| 28 |
echo "Opening fileinfo database failed";
|
| 29 |
exit();
|
| 30 |
}
|
| 31 |
?>
|
| 32 |
Replace 'usr/share/file' by the magic file path if it's different on your server.
|